proteum 2.1.9 → 2.2.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/.codex/environments/environment.toml +11 -0
- package/AGENTS.md +27 -11
- package/README.md +30 -11
- package/agents/project/AGENTS.md +172 -123
- package/agents/project/CODING_STYLE.md +1 -1
- package/agents/project/app-root/AGENTS.md +16 -0
- package/agents/project/client/AGENTS.md +5 -5
- package/agents/project/client/pages/AGENTS.md +13 -13
- package/agents/project/diagnostics.md +19 -10
- package/agents/project/optimizations.md +5 -6
- package/agents/project/root/AGENTS.md +297 -0
- package/agents/project/server/routes/AGENTS.md +2 -2
- package/agents/project/server/services/AGENTS.md +4 -2
- package/agents/project/tests/AGENTS.md +9 -2
- package/cli/app/index.ts +31 -7
- package/cli/commands/configure.ts +226 -0
- package/cli/commands/dev.ts +0 -2
- package/cli/commands/diagnose.ts +33 -1
- package/cli/commands/explain.ts +1 -1
- package/cli/commands/migrate.ts +51 -0
- package/cli/commands/orient.ts +169 -0
- package/cli/commands/perf.ts +8 -1
- package/cli/commands/verify.ts +1003 -49
- package/cli/compiler/artifacts/manifest.ts +4 -4
- package/cli/compiler/artifacts/routing.ts +2 -2
- package/cli/compiler/artifacts/services.ts +12 -3
- package/cli/compiler/client/index.ts +65 -19
- package/cli/compiler/common/files/style.ts +47 -2
- package/cli/compiler/common/generatedRouteModules.ts +31 -38
- package/cli/compiler/common/index.ts +10 -0
- package/cli/compiler/common/proteumManifest.ts +1 -0
- package/cli/compiler/server/index.ts +34 -9
- package/cli/context.ts +6 -1
- package/cli/index.ts +7 -8
- package/cli/migrate/pageContract.ts +516 -0
- package/cli/paths.ts +47 -6
- package/cli/presentation/commands.ts +100 -10
- package/cli/presentation/devSession.ts +4 -6
- package/cli/presentation/help.ts +2 -2
- package/cli/presentation/ink.ts +10 -5
- package/cli/presentation/welcome.ts +2 -4
- package/cli/runtime/commands.ts +94 -1
- package/cli/scaffold/index.ts +2 -2
- package/cli/scaffold/templates.ts +4 -2
- package/cli/utils/agents.ts +273 -58
- package/client/dev/profiler/index.tsx +3 -2
- package/client/router.ts +10 -2
- package/client/services/router/index.tsx +6 -22
- package/common/dev/connect.ts +20 -4
- package/common/dev/console.ts +7 -0
- package/common/dev/contractsDoctor.ts +354 -0
- package/common/dev/diagnostics.ts +10 -7
- package/common/dev/inspection.ts +830 -38
- package/common/dev/performance.ts +19 -5
- package/common/dev/profiler.ts +1 -0
- package/common/dev/proteumManifest.ts +5 -4
- package/common/dev/requestTrace.ts +78 -1
- package/common/env/proteumEnv.ts +10 -3
- package/common/router/contracts.ts +8 -11
- package/common/router/index.ts +2 -2
- package/common/router/pageData.ts +72 -0
- package/common/router/register.ts +10 -46
- package/common/router/response/page.ts +28 -16
- package/docs/assets/unique-domains-chip.png +0 -0
- package/docs/dev-sessions.md +8 -4
- package/docs/diagnostics.md +77 -11
- package/docs/migrate-from-2.1.3.md +388 -0
- package/docs/request-tracing.md +42 -9
- package/package.json +6 -1
- package/scripts/update-codex-agents.ts +2 -2
- package/server/app/container/console/index.ts +11 -1
- package/server/app/container/trace/index.ts +370 -72
- package/server/app/devDiagnostics.ts +1 -1
- package/server/app/index.ts +5 -1
- package/server/services/auth/index.ts +9 -0
- package/server/services/prisma/index.ts +15 -12
- package/server/services/router/http/index.ts +1 -1
- package/server/services/router/index.ts +105 -23
- package/server/services/router/request/api.ts +7 -1
- package/server/services/router/request/index.ts +2 -1
- package/server/services/router/response/index.ts +8 -28
- package/types/global/vendors.d.ts +12 -0
- package/types/vendors.d.ts +12 -0
- package/common/router/pageSetup.ts +0 -51
package/agents/project/AGENTS.md
CHANGED
|
@@ -1,45 +1,73 @@
|
|
|
1
1
|
# Proteum Project Contract
|
|
2
2
|
|
|
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
|
-
|
|
3
|
+
This is the canonical standalone-app 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
|
+
When splitting instructions across a monorepo, put the Proteum-wide rules in the monorepo-root `AGENTS.md` and keep only app-root-specific additions in each Proteum app root `AGENTS.md`.
|
|
5
|
+
Role: keep only project-wide app rules here when one root `AGENTS.md` must carry both the reusable Proteum contract and the app-root addendum.
|
|
5
6
|
Keep here: cross-cutting project workflow, architecture contracts, shared typing rules, and rules that apply across client, server, pages, and tests.
|
|
6
7
|
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`.
|
|
7
8
|
|
|
8
|
-
Optimization source of truth:
|
|
9
|
-
Diagnostics source of truth:
|
|
10
|
-
Coding style source of truth:
|
|
9
|
+
Optimization source of truth: root-level `optimizations.md`.
|
|
10
|
+
Diagnostics source of truth: root-level `diagnostics.md`.
|
|
11
|
+
Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
12
|
+
|
|
13
|
+
## Fast Triggers
|
|
14
|
+
|
|
15
|
+
- If you are working in a newly created Proteum worktree, before following the rest of these instructions:
|
|
16
|
+
- Copy `.env` from the main worktree.
|
|
17
|
+
- Run `npx proteum refresh`.
|
|
18
|
+
- Read and acknowledge the applicable `AGENTS.md` files.
|
|
19
|
+
- Run `npm i`.
|
|
20
|
+
- Run the dev server with the task-safe elevated-permissions launch workflow from `Task Lifecycle`, keep it running so user can see the results by himself, and print the live server URL as a clickable Markdown link.
|
|
21
|
+
- 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. After this, everytime you implemented a fix
|
|
22
|
+
- test, re-run analysis and give a comparizon table of before and after
|
|
23
|
+
- re-print the complete list of suggested fixes, but strike the ones we already implemented or not necessary anymore
|
|
24
|
+
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>` before reading large parts of the codebase.
|
|
25
|
+
- If the user reports an issue, or the agent encounters one during exploration, implementation, verification, or runtime reproduction, load and follow root-level `diagnostics.md`.
|
|
26
|
+
- If the task touches client-side files, especially `client/**` and page files, load and apply root-level `optimizations.md` only after implementation for post-implementation checking and optimization. Skip it at task start and skip it for server-only, test-only, doc-only, and non-client refactor tasks unless the user explicitly asks for optimization work.
|
|
27
|
+
- If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning, read the relevant files under `./docs/` first, especially `docs/PERSONAS.md`, `docs/PRODUCT.md`, and `docs/MARKETING.md` when they exist. If a dev server is already running, print the live dev server URL as a clickable Markdown link.
|
|
28
|
+
- If the task needs 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.
|
|
29
|
+
- If you changed `schema.prisma`, do not start testing or validation yet. Ask the user to run the following command in the affected worktree directory, replacing the placeholders, and wait for the user to reply exactly `continue` before resuming validation or tests:
|
|
30
|
+
```
|
|
31
|
+
cd <worktree path>
|
|
32
|
+
npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
|
|
33
|
+
```
|
|
34
|
+
- If you encounter `runtime/provider-hook-outside-provider`, `runtime/client-only-hook-in-ssr`, `runtime/router-context-outside-router`, or `runtime/connected-boundary-mismatch`, treat it as a framework contract failure first. Fix the provider, SSR/client, router, or connected boundary before assuming a local leaf-component bug.
|
|
35
|
+
- If the change is runtime-visible, request-time, router, SSR, browser-visible, or controller-behavior, use running-app verification.
|
|
36
|
+
- If the change is docs-only, wording-only, type-only, test-only, generated-output cleanup, or a clearly local non-runtime refactor, use static verification only unless the user explicitly asks for runtime verification or the agent finds a real issue.
|
|
37
|
+
- If the user replies exactly `commit`, generate one top-level short (up to 100 characters) sentence covering all changes made since the last `commit` and, if there has been no prior `commit`, since the beginning of the whole conversation, strictly using the Conventional Commits specification:
|
|
38
|
+
```
|
|
39
|
+
<type>[optional scope]: <description>
|
|
40
|
+
|
|
41
|
+
[optional body]
|
|
42
|
+
```
|
|
43
|
+
Then use that generated message, stage the task-related changed files with `git add` while avoiding unrelated user changes or incidental untracked files, and create the commit by running `git commit`. Do not stop at only suggesting the message.
|
|
44
|
+
After providing a commit message or after creating a commit, immediately follow it with this exact prompt and obey it:
|
|
45
|
+
`Explain in short minimalistic and few bullet points what we changed in this thread, like you would do to your grandma. Start with a verb in the past.`
|
|
46
|
+
|
|
47
|
+
## Task Lifecycle
|
|
48
|
+
|
|
49
|
+
### Before Editing
|
|
50
|
+
|
|
51
|
+
- Before changing any file, load root-level `CODING_STYLE.md` and any narrower area `AGENTS.md` that applies to the touched files. Do not spend response space explicitly acknowledging those reads unless the user asks.
|
|
52
|
+
|
|
53
|
+
### During Implementation
|
|
11
54
|
|
|
12
|
-
## Workflow
|
|
13
|
-
|
|
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
55
|
- After running `npx proteum create ...`, adapt the generated code to the real feature instead of leaving placeholder logic in place.
|
|
19
|
-
- When starting a long-lived dev server for an agent task,
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- 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.
|
|
25
|
-
- Before finishing a task, stop every `proteum dev` session started during the task and confirm cleanup with `npx proteum dev list --json` or an explicit `npx proteum dev stop --session-file <path>`.
|
|
26
|
-
- 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. Strictly use the Conventional Commits specification:
|
|
27
|
-
```
|
|
28
|
-
Commit message: <type>[optional scope]: <description>
|
|
29
|
-
|
|
30
|
-
[optional body]
|
|
31
|
-
```
|
|
56
|
+
- When starting a long-lived dev server for an agent task, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit task/thread-scoped session file such as `var/run/proteum/dev/agents/<task>.json`, inspect `npx proteum dev list --json` plus current listeners first, for example with `lsof -nP -iTCP -sTCP:LISTEN`, then choose a port that is not currently used before starting `npx proteum dev --session-file <path> --port <port>`. After the server is ready, print the live server URL as a clickable Markdown link.
|
|
57
|
+
- Use `--replace-existing` only when restarting the exact session file started by the current thread/task. Never replace another live session that belongs to a user, another thread, or an unknown owner.
|
|
58
|
+
- If the current app depends on local `file:` connected projects, boot every connected producer app too, each with its own task-scoped session file and free port, and run every one of those `proteum dev` processes with elevated permissions outside the sandbox before starting or verifying the consumer app.
|
|
59
|
+
- For raw browser automation, use `npx proteum verify browser` when it matches the task, or direct Playwright with a disposable profile when lower-level control is required. Bootstrap protected browser state through `npx proteum session`.
|
|
60
|
+
- Current CLI banner contract: only the bare `proteum build` and bare `proteum dev` commands print the welcome banner and include the active Proteum installation method. Any extra argument or option skips the banner. Only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner.
|
|
32
61
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
This is a TypeScript, Node.js, Preact, Proteum monolith:
|
|
62
|
+
### Before Finishing
|
|
36
63
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
64
|
+
- Before finishing, re-check touched files against root-level `CODING_STYLE.md` and any narrower area `AGENTS.md` that applied to the edit. Re-check against root-level `optimizations.md` only for touched client-side files. Re-check against root-level `diagnostics.md` only if the task involved an issue, diagnosis, runtime reproduction, or verification failure.
|
|
65
|
+
- Do not default to project-wide typecheck or `npx proteum check` after every change. After implementing a new feature or changing existing feature behavior, always update the end-to-end coverage for that behavior and run the full Playwright test suite before finishing. For docs-only, wording-only, type-only, test-only, generated-output cleanup, or clearly local non-runtime refactors, skip Playwright unless the user explicitly asks for it or verification reveals a real issue.
|
|
66
|
+
- Before finishing a task, stop every `proteum dev` session started during the task and confirm cleanup with `npx proteum dev list --json` or an explicit `npx proteum dev stop --session-file <path>`.
|
|
67
|
+
- When you have finished your work, ask the user whether they want a commit message. After providing a commit message or after creating a commit, immediately follow it with this exact prompt and obey it:
|
|
68
|
+
`Explain in short minimalistic and few bullet points what we changed in this thread, like you would do to your grandma. Start with a verb in the past.`
|
|
41
69
|
|
|
42
|
-
##
|
|
70
|
+
## Core Contracts
|
|
43
71
|
|
|
44
72
|
- Client pages live in `client/pages/**` and register routes with top-level `Router.page(...)` or `Router.error(...)`.
|
|
45
73
|
- Page URLs come from the explicit `Router.page('/path', ...)` call, not from the file path.
|
|
@@ -48,11 +76,12 @@ This is a TypeScript, Node.js, Preact, Proteum monolith:
|
|
|
48
76
|
- Manual HTTP endpoints live only in `server/routes/**`.
|
|
49
77
|
- Controllers call `this.input(schema)` inside the method body, at most once per method.
|
|
50
78
|
- Request-scoped state lives only on `this.request` and manual-route/router context objects.
|
|
51
|
-
- Follow project-root `optimizations.md` for bundle size, performance, SEO, and SSR page-size rules.
|
|
52
79
|
- Keep one class or one React/Preact component per file.
|
|
53
80
|
- Prefer a deep tree grouped by business concern instead of long file names.
|
|
54
81
|
- Use the default `*.ts` or `*.tsx` file unless an `*.ssr.ts` or `*.ssr.tsx` variant is truly required.
|
|
55
82
|
- Never edit generated files under `.proteum`.
|
|
83
|
+
- When a task changes database structure, edit the app's `schema.prisma` only.
|
|
84
|
+
- Never create or edit migration files manually.
|
|
56
85
|
- Use `@generated/client/*`, `@generated/common/*`, and `@generated/server/*` for generated surfaces.
|
|
57
86
|
- Client context is typically imported from `@/client/context`.
|
|
58
87
|
- Normal service methods do not read request state directly.
|
|
@@ -61,63 +90,7 @@ This is a TypeScript, Node.js, Preact, Proteum monolith:
|
|
|
61
90
|
- Do not use `@app` on the client.
|
|
62
91
|
- Prefer type inference rooted in the explicit application graph in `server/index.ts`.
|
|
63
92
|
|
|
64
|
-
##
|
|
65
|
-
|
|
66
|
-
Proteum reads:
|
|
67
|
-
|
|
68
|
-
- `package.json`
|
|
69
|
-
- `identity.config.ts` for app identity via `Application.identity({ ... })`
|
|
70
|
-
- `proteum.config.ts` for compiler setup via `Application.setup({ transpile, connect })`
|
|
71
|
-
- `process.env` via `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, any app-chosen connected-project values referenced by `proteum.config.ts`, and `TRACE_*`
|
|
72
|
-
- `server/config/*.ts`
|
|
73
|
-
- `server/index.ts`
|
|
74
|
-
- `commands/**/*.ts`
|
|
75
|
-
- `server/controllers/**/*.ts`
|
|
76
|
-
- `server/routes/**/*.ts`
|
|
77
|
-
- `client/pages/**/*.ts(x)`
|
|
78
|
-
- `client/pages/**/_layout/index.tsx`
|
|
79
|
-
- `public/**`
|
|
80
|
-
|
|
81
|
-
Proteum owns:
|
|
82
|
-
|
|
83
|
-
- `.proteum/manifest.json`
|
|
84
|
-
- `.proteum/client/*`
|
|
85
|
-
- `.proteum/common/*`
|
|
86
|
-
- `.proteum/server/*`
|
|
87
|
-
|
|
88
|
-
Project code should consume:
|
|
89
|
-
|
|
90
|
-
- `@generated/client/*`
|
|
91
|
-
- `@generated/common/*`
|
|
92
|
-
- `@generated/server/*`
|
|
93
|
-
- `@/client/context` as the generated client context entrypoint
|
|
94
|
-
|
|
95
|
-
Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
96
|
-
|
|
97
|
-
- `npx proteum connect --json`
|
|
98
|
-
- `npx proteum connect --controllers --strict`
|
|
99
|
-
- `npx proteum explain --json`
|
|
100
|
-
- `npx proteum explain --connected --controllers`
|
|
101
|
-
- `npx proteum explain owner <query>`
|
|
102
|
-
- `npx proteum doctor --json`
|
|
103
|
-
- `npx proteum doctor --contracts --json`
|
|
104
|
-
- `npx proteum diagnose <path> --port <port>`
|
|
105
|
-
- `npx proteum perf ...`
|
|
106
|
-
- `npx proteum trace ...`
|
|
107
|
-
- `npx proteum command ...`
|
|
108
|
-
- `npx proteum session ...`
|
|
109
|
-
- `npx proteum create ... --dry-run --json`
|
|
110
|
-
- `npx proteum dev list --json`
|
|
111
|
-
- `npx proteum dev stop --session-file <path>`
|
|
112
|
-
|
|
113
|
-
Prefer scaffold commands before hand-writing boilerplate:
|
|
114
|
-
|
|
115
|
-
- Use `npx proteum init <directory> --name <name>` for new apps.
|
|
116
|
-
- Use `npx proteum init ... --dry-run --json` when an agent needs a machine-readable app plan before writing files.
|
|
117
|
-
- Use `npx proteum create page|controller|command|route|service <target>` for new app artifacts before creating the files manually.
|
|
118
|
-
- Use `npx proteum create ... --dry-run --json` when an agent needs a machine-readable artifact plan before writing files.
|
|
119
|
-
|
|
120
|
-
## File Contracts
|
|
93
|
+
## Surface Contracts
|
|
121
94
|
|
|
122
95
|
### App Bootstrap And Services
|
|
123
96
|
|
|
@@ -125,6 +98,7 @@ Prefer scaffold commands before hand-writing boilerplate:
|
|
|
125
98
|
- Root services are public class fields instantiated with `new ServiceClass(this, config, this)`.
|
|
126
99
|
- Typed root-service config lives in `server/config/*.ts` via `Services.config(ServiceClass, { ... })`.
|
|
127
100
|
- Router plugins are instantiated explicitly inside the `Router` config `plugins` object.
|
|
101
|
+
- Router plugins can subscribe to `request` and `request.finished`; `request.profiling` exists before `request` runs and carries the finalized request/API/SQL snapshot by `request.finished`.
|
|
128
102
|
- Root business services live in `server/services/<Feature>/index.ts`.
|
|
129
103
|
- Root-service config lives in `server/config/*.ts` when the service needs config.
|
|
130
104
|
- Business logic lives in classes that extend `Service` and use `this.services`, `this.models`, and `this.app`.
|
|
@@ -138,6 +112,7 @@ Prefer scaffold commands before hand-writing boilerplate:
|
|
|
138
112
|
- Declare connected namespaces in `proteum.config.ts` with explicit values such as `connect: { Product: { source: PRODUCT_CONNECTED_SOURCE, urlInternal: PRODUCT_URL_INTERNAL } }`.
|
|
139
113
|
- Proteum does not infer connected env key names from the namespace. The source and internal URL must be provided explicitly in `proteum.config.ts`.
|
|
140
114
|
- Use `npx proteum connect` to inspect configured connect values, cached contract state, and imported controllers for the current app.
|
|
115
|
+
- Before launching a consumer app that depends on local `file:` connected sources, launch every connected producer app too, assign each one a free port, run each `proteum dev` outside the sandbox with elevated permissions, and make sure `connect.<Namespace>.urlInternal` resolves to those live producer URLs.
|
|
141
116
|
- `file:` connected sources point at another Proteum app root and keep strong connected typings.
|
|
142
117
|
- Non-local connected sources provide runtime helper generation but are intentionally typed loosely.
|
|
143
118
|
|
|
@@ -164,14 +139,14 @@ Prefer scaffold commands before hand-writing boilerplate:
|
|
|
164
139
|
|
|
165
140
|
- Proteum scans page files for top-level `Router.page(...)` and `Router.error(...)` calls.
|
|
166
141
|
- File path controls chunk identity and layout discovery; route path comes from the explicit `Router.page(...)` string.
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
- `
|
|
170
|
-
- Controller fetchers and promises returned from `
|
|
171
|
-
- `render` consumes resolved
|
|
172
|
-
- Use `api.reload(...)` or `api.set(...)` only when intentionally mutating active page
|
|
142
|
+
- The only supported page signature is `Router.page(path, options, data, render)`.
|
|
143
|
+
- `options` is always required. `data` is the only nullable argument and must be `null` when the page has no SSR data loader.
|
|
144
|
+
- `data` returns one flat object. Route-option keys such as `auth`, `layout`, `static`, and `_static` are forbidden in page data and must live in `options`.
|
|
145
|
+
- Controller fetchers and promises returned from `data` resolve before render.
|
|
146
|
+
- `render` consumes resolved page data and uses generated controller methods from render args or `@/client/context`.
|
|
147
|
+
- Use `api.reload(...)` or `api.set(...)` only when intentionally mutating active page data state.
|
|
173
148
|
- Error pages use `Router.error(code, options, render)` in `client/pages/_messages/**`.
|
|
174
|
-
- Prefer `proteum create page ...` for new page boilerplate, then review the explicit route path and
|
|
149
|
+
- Prefer `proteum create page ...` for new page boilerplate, then review the explicit route path, options object, and data payload.
|
|
175
150
|
|
|
176
151
|
### Manual Routes
|
|
177
152
|
|
|
@@ -193,15 +168,32 @@ Prefer scaffold commands before hand-writing boilerplate:
|
|
|
193
168
|
- `@app`: server-side application services for manual routes only
|
|
194
169
|
- `@generated/*`: generated app surfaces
|
|
195
170
|
|
|
196
|
-
##
|
|
171
|
+
## Verification Matrix
|
|
172
|
+
|
|
173
|
+
Verify at the correct layer:
|
|
174
|
+
|
|
175
|
+
- Default: use the cheapest trustworthy verification for the changed surface first, then escalate only if the changed surface justifies it.
|
|
176
|
+
- Route additions: boot the app and hit the real URL.
|
|
177
|
+
- Controller changes: exercise the generated client call or generated `/api/...` endpoint.
|
|
178
|
+
- SSR changes: load the real page and inspect rendered HTML plus browser console.
|
|
179
|
+
- Router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app.
|
|
180
|
+
- New features or feature-behavior changes: use the cheapest trustworthy verification while iterating, then update the relevant end-to-end coverage and finish by running the full Playwright suite.
|
|
181
|
+
- Generated, connected, or ownership-ambiguous changes: start with `npx proteum orient <query>` and prefer `npx proteum verify owner <query>` before broad global checks.
|
|
182
|
+
- Browser-visible issues: prefer `npx proteum verify browser <path>` or the narrowest targeted Playwright pass only after request-level verification is insufficient.
|
|
183
|
+
- Raw browser execution beyond `npx proteum verify browser`: use direct Playwright with a disposable profile, and keep that step for the final verifier agent unless a narrower surface cannot reproduce the issue.
|
|
184
|
+
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
|
|
185
|
+
|
|
186
|
+
## Implementation Rules
|
|
187
|
+
|
|
188
|
+
### Dependency Selection
|
|
197
189
|
|
|
198
190
|
- Before implementing a feature or change, first check whether the repo already includes a suitable dependency.
|
|
199
191
|
- If not, search npm before building a new utility, abstraction, component primitive, parser, formatter, or integration from scratch.
|
|
200
192
|
- Prefer the most popular, flexible, maintained packages that fit the project constraints.
|
|
201
|
-
-
|
|
193
|
+
- When the task explicitly involves client-side optimization work, use root-level `optimizations.md` to decide whether custom infrastructure is justified over an existing package.
|
|
202
194
|
- When you choose custom over a package, explain the reason briefly.
|
|
203
195
|
|
|
204
|
-
|
|
196
|
+
### Catalogs And Typing
|
|
205
197
|
|
|
206
198
|
- Keep one canonical catalog or registry file and import it everywhere else.
|
|
207
199
|
- Client-only catalogs live in `/client/catalogs/**`, server-only catalogs in `/server/catalogs/**`, and shared catalogs in `/common/catalogs/**`.
|
|
@@ -211,7 +203,7 @@ Prefer scaffold commands before hand-writing boilerplate:
|
|
|
211
203
|
- Fix typing issues only on code you wrote.
|
|
212
204
|
- Never cast with `as any` or `as unknown`; fix the contract or add an explicit typed adapter.
|
|
213
205
|
|
|
214
|
-
|
|
206
|
+
### Design Rules
|
|
215
207
|
|
|
216
208
|
- Prefer explicit `server/index.ts` bootstrap over hidden registration.
|
|
217
209
|
- Prefer controller-backed app APIs over ad hoc manual `/api/...` routes.
|
|
@@ -219,40 +211,97 @@ Prefer scaffold commands before hand-writing boilerplate:
|
|
|
219
211
|
- Keep one canonical source of truth for catalogs, registries, and shared types.
|
|
220
212
|
- Reuse shared Shadcn-based UI primitives when the project already provides them.
|
|
221
213
|
|
|
222
|
-
|
|
214
|
+
### Discouraged Patterns
|
|
223
215
|
|
|
224
216
|
- request-scoped state inside normal service methods
|
|
225
217
|
- hiding route registration behind abstractions that remove the top-level `Router.page(...)` call
|
|
226
218
|
- editing `.proteum` directly
|
|
227
219
|
|
|
228
|
-
##
|
|
220
|
+
## Hard Stops
|
|
229
221
|
|
|
230
|
-
|
|
222
|
+
- Never run schema-mutating SQL such as `ALTER TABLE`, `CREATE TABLE`, `DROP TABLE`, or `CREATE INDEX` to change database structure.
|
|
223
|
+
- Do not run `prisma *` yourself. If a schema change requires migration, ask the user to run `npx prisma migrate dev --config ./prisma.config.ts --name <migration name>` and wait for `continue`.
|
|
224
|
+
- Do not run `git restore` or `git reset`.
|
|
225
|
+
- Do not run write-mode git commands by default. The built-in exception is an exact `commit` reply, which allows only task-scoped `git add` and `git commit`. Any other write-mode git action requires an explicit user request.
|
|
231
226
|
|
|
232
|
-
|
|
233
|
-
- controller changes: exercise the generated client call or generated `/api/...` endpoint
|
|
234
|
-
- SSR changes: load the real page and inspect rendered HTML plus browser console
|
|
235
|
-
- router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app
|
|
236
|
-
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow project-root `diagnostics.md`.
|
|
227
|
+
## Appendix
|
|
237
228
|
|
|
238
|
-
|
|
229
|
+
### Project Shape
|
|
239
230
|
|
|
240
|
-
|
|
231
|
+
This is a TypeScript, Node.js, Preact, Proteum monolith:
|
|
241
232
|
|
|
242
|
-
|
|
233
|
+
- `/client`: assets, catalogs, components, hooks, pages
|
|
234
|
+
- `/common`: shared functions, constants, types, and catalogs
|
|
235
|
+
- `/server`: catalogs, config, services, routes, lib
|
|
236
|
+
- `/tests`
|
|
243
237
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
238
|
+
### Source Of Truth
|
|
239
|
+
|
|
240
|
+
Proteum reads:
|
|
241
|
+
|
|
242
|
+
- `package.json`
|
|
243
|
+
- `identity.config.ts` for app identity via `Application.identity({ ... })`
|
|
244
|
+
- `proteum.config.ts` for compiler setup via `Application.setup({ transpile, connect })`
|
|
245
|
+
- `process.env` via `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, any app-chosen connected-project values referenced by `proteum.config.ts`, `TRACE_*`, and `ENABLE_PROFILER`
|
|
246
|
+
- `server/config/*.ts`
|
|
247
|
+
- `server/index.ts`
|
|
248
|
+
- `commands/**/*.ts`
|
|
249
|
+
- `server/controllers/**/*.ts`
|
|
250
|
+
- `server/routes/**/*.ts`
|
|
251
|
+
- `client/pages/**/*.ts(x)`
|
|
252
|
+
- `client/pages/**/_layout/index.tsx`
|
|
253
|
+
- `public/**`
|
|
254
|
+
|
|
255
|
+
Proteum owns:
|
|
256
|
+
|
|
257
|
+
- `.proteum/manifest.json`
|
|
258
|
+
- `.proteum/client/*`
|
|
259
|
+
- `.proteum/common/*`
|
|
260
|
+
- `.proteum/server/*`
|
|
261
|
+
|
|
262
|
+
Project code should consume:
|
|
263
|
+
|
|
264
|
+
- `@generated/client/*`
|
|
265
|
+
- `@generated/common/*`
|
|
266
|
+
- `@generated/server/*`
|
|
267
|
+
- `@/client/context` as the generated client context entrypoint
|
|
268
|
+
|
|
269
|
+
### Useful Commands
|
|
270
|
+
|
|
271
|
+
Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
272
|
+
|
|
273
|
+
- `npx proteum connect --json`
|
|
274
|
+
- `npx proteum connect --controllers --strict`
|
|
275
|
+
- `npx proteum orient <query>`
|
|
276
|
+
- `npx proteum explain --json`
|
|
277
|
+
- `npx proteum explain --connected --controllers`
|
|
278
|
+
- `npx proteum explain owner <query>`
|
|
279
|
+
- `npx proteum doctor --json`
|
|
280
|
+
- `npx proteum doctor --contracts --json`
|
|
281
|
+
- `npx proteum diagnose <path> --port <port>`
|
|
282
|
+
- `npx proteum verify owner <query>`
|
|
283
|
+
- `npx proteum verify request <path>`
|
|
284
|
+
- `npx proteum verify browser <path>`
|
|
285
|
+
- `npx proteum perf ...`
|
|
286
|
+
- `npx proteum trace ...`
|
|
287
|
+
- `npx proteum command ...`
|
|
288
|
+
- `npx proteum session ...`
|
|
289
|
+
- `npx proteum create ... --dry-run --json`
|
|
290
|
+
- `npx proteum dev list --json`
|
|
291
|
+
- `npx proteum dev stop --session-file <path>`
|
|
292
|
+
|
|
293
|
+
Prefer scaffold commands before hand-writing boilerplate:
|
|
248
294
|
|
|
249
|
-
|
|
295
|
+
- `npx proteum init <directory> --name <name>`
|
|
296
|
+
- `npx proteum init ... --dry-run --json`
|
|
297
|
+
- `npx proteum create page|controller|command|route|service <target>`
|
|
298
|
+
- `npx proteum create ... --dry-run --json`
|
|
250
299
|
|
|
251
|
-
-
|
|
252
|
-
- `git reset`
|
|
253
|
-
- `prisma *`
|
|
254
|
-
- any write-mode git command
|
|
300
|
+
### High-Impact Files
|
|
255
301
|
|
|
256
|
-
|
|
302
|
+
Edit these only when required, and keep changes minimal and explicit:
|
|
257
303
|
|
|
258
|
-
|
|
304
|
+
- `tsconfig*.json`
|
|
305
|
+
- `PORT`, `ENV_*`, `URL`, `TRACE_*`, and `ENABLE_PROFILER` env setup
|
|
306
|
+
- Prisma-generated files
|
|
307
|
+
- symbolic links
|
|
@@ -17,7 +17,7 @@ This file is the source of truth for codex coding style instructions in Proteum-
|
|
|
17
17
|
- Keep short arrow functions and short returned object literals compact when they are easy to scan.
|
|
18
18
|
- Keep JSX multiline only when it is clearly more readable; otherwise keep short JSX compact.
|
|
19
19
|
- Avoid staircase formatting and unnecessary blank lines inside short callbacks.
|
|
20
|
-
- Keep `Router.page(...)` and `Router.error(...)` registrations in the compact inline-call shape when possible, for example `Router.page('/path',
|
|
20
|
+
- Keep `Router.page(...)` and `Router.error(...)` registrations in the compact inline-call shape when possible, for example `Router.page('/path', {}, null, render);`.
|
|
21
21
|
|
|
22
22
|
## File organization
|
|
23
23
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Proteum App-Root Addendum
|
|
2
|
+
|
|
3
|
+
This file is the app-root-only addendum for a Proteum app that lives inside a larger monorepo.
|
|
4
|
+
Keep the reusable Proteum contract in the nearest ancestor root `AGENTS.md`, and keep this file only for instructions that depend on the current directory being the Proteum app root.
|
|
5
|
+
Role: keep only app-root workflow and local project-semantic rules here.
|
|
6
|
+
Do not put here: reusable Proteum architecture contracts, shared verification rules, diagnostics workflow, optimization checklists, coding-style details, or area-specific rules already covered by broader `AGENTS.md` files or the root-level `diagnostics.md`, `optimizations.md`, and `CODING_STYLE.md`.
|
|
7
|
+
|
|
8
|
+
## App-Root Triggers
|
|
9
|
+
|
|
10
|
+
- If you are working in a newly created Proteum worktree, before following the rest of these instructions:
|
|
11
|
+
- Copy `.env` from the main worktree.
|
|
12
|
+
- Run `npx proteum refresh`.
|
|
13
|
+
- Read and acknowledge the applicable `AGENTS.md` files.
|
|
14
|
+
- Run `npm i`.
|
|
15
|
+
- Run the dev server with the task-safe elevated-permissions launch workflow from the reusable root `AGENTS.md`, keep it running so user can see the results by himself, and print the live server URL as a clickable Markdown link.
|
|
16
|
+
- If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning, read the relevant files under `./docs/` first, especially `docs/PERSONAS.md`, `docs/PRODUCT.md`, and `docs/MARKETING.md` when they exist. If a dev server is already running, print the live dev server URL as a clickable Markdown link.
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
This is the canonical client-area contract for Proteum-based projects.
|
|
4
4
|
Role: keep only client-area rules here.
|
|
5
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 `
|
|
6
|
+
Do not put here: page `data` and route-registration details, server/service rules, or generic project workflow already covered by broader ancestor `AGENTS.md` files.
|
|
7
7
|
|
|
8
|
-
Optimization source of truth:
|
|
9
|
-
Diagnostics source of truth:
|
|
10
|
-
Coding style source of truth:
|
|
8
|
+
Optimization source of truth: root-level `optimizations.md`.
|
|
9
|
+
Diagnostics source of truth: root-level `diagnostics.md`.
|
|
10
|
+
Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
11
11
|
|
|
12
12
|
## Stack
|
|
13
13
|
|
|
@@ -39,4 +39,4 @@ Coding style source of truth: project-root `CODING_STYLE.md`.
|
|
|
39
39
|
- Keep one component per file.
|
|
40
40
|
- Load data and define handlers in the directly concerned component when that keeps ownership clearer.
|
|
41
41
|
- Keep curated lists, option registries, and UI copy catalogs under `/client/catalogs/**`.
|
|
42
|
-
- Follow the section-comment format from the
|
|
42
|
+
- Follow the section-comment format from the root-level `CODING_STYLE.md`.
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
This is the canonical page-file contract for Proteum-based projects.
|
|
4
4
|
Role: keep only page-file rules here.
|
|
5
|
-
Keep here: `Router.page(...)` registration, SSR `
|
|
5
|
+
Keep here: `Router.page(...)` registration, SSR `data` and `render` contracts, page payload shape, and page-local typing rules.
|
|
6
6
|
Do not put here: generic component rules, server/service implementation details, or app-wide workflow already covered by broader AGENTS files.
|
|
7
7
|
|
|
8
|
-
Optimization source of truth:
|
|
9
|
-
Diagnostics source of truth:
|
|
10
|
-
Coding style source of truth:
|
|
8
|
+
Optimization source of truth: root-level `optimizations.md`.
|
|
9
|
+
Diagnostics source of truth: root-level `diagnostics.md`.
|
|
10
|
+
Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
11
11
|
|
|
12
12
|
## Router.page Usage
|
|
13
13
|
|
|
14
14
|
- Proteum scans page files for top-level `Router.page(...)` and `Router.error(...)` calls.
|
|
15
15
|
- File path controls chunk identity and layout discovery; route path comes from the explicit `Router.page(...)` string.
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
16
|
+
- The only supported page signature is `Router.page(path, options, data, render)`.
|
|
17
|
+
- `options` is always required and must be an object.
|
|
18
|
+
- `data` is the only nullable argument. Pass `null` when the page does not need SSR data.
|
|
19
19
|
- Keep the `Router.page(...)` call compact instead of exploding each outer argument onto its own line.
|
|
20
20
|
- Keep route registration at top level. Do not hide it behind helper abstractions.
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Data And Render
|
|
23
23
|
|
|
24
|
-
- `
|
|
25
|
-
- `
|
|
26
|
-
-
|
|
27
|
-
- Controller fetchers and promises returned from `
|
|
28
|
-
- If a page needs route data, return it from `
|
|
24
|
+
- Route behavior belongs in the explicit `options` object, not in page data.
|
|
25
|
+
- `data` returns one flat object or `null` is passed as the third argument when no page data is needed.
|
|
26
|
+
- Returning route-option keys such as `auth`, `layout`, `static`, `redirectLogged`, or their `_`-prefixed variants from `data` is a contract error.
|
|
27
|
+
- Controller fetchers and promises returned from `data` resolve before render.
|
|
28
|
+
- If a page needs route data, return it from `data` and read it in `render`.
|
|
29
29
|
|
|
30
30
|
## Page Rules
|
|
31
31
|
|
|
@@ -4,7 +4,7 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
4
4
|
|
|
5
5
|
## Initial Triage
|
|
6
6
|
|
|
7
|
-
- Start with machine-readable app state before reading large parts of the codebase: `./.proteum/manifest.json`, `npx proteum connect --json`, `npx proteum explain --json`, `npx proteum doctor --json`, and `npx proteum doctor --contracts --json` when generated artifacts or manifest-owned files may be stale.
|
|
7
|
+
- Start with machine-readable app state before reading large parts of the codebase: `npx proteum orient <query>`, `./.proteum/manifest.json`, `npx proteum connect --json`, `npx proteum explain --json`, `npx proteum doctor --json`, and `npx proteum doctor --contracts --json` when generated artifacts or manifest-owned files may be stale.
|
|
8
8
|
- When one app depends on another app's generated controllers, inspect `npx proteum connect --controllers`, `npx proteum explain --connected --controllers`, the producer `proteum.connected.json`, the consumer `proteum.config.ts` connected `source` value, and the producer `./.proteum/proteum.connected.d.ts` before assuming the contract is local.
|
|
9
9
|
- Use `rg -n` first to narrow the exact code path, then read only the relevant files.
|
|
10
10
|
- Inspect `./server/index.ts`, `./server/config/*.ts`, and the touched files under `./commands`, `./server/controllers`, `./server/services`, `./server/routes`, `./client/pages`, and `./tests`.
|
|
@@ -12,23 +12,28 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
12
12
|
|
|
13
13
|
## Runtime Diagnostics
|
|
14
14
|
|
|
15
|
-
- For long-lived dev reproductions,
|
|
16
|
-
-
|
|
15
|
+
- For long-lived dev reproductions, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit task/thread-scoped session file, inspect `npx proteum dev list --json` plus current listeners first, for example with `lsof -nP -iTCP -sTCP:LISTEN`, then choose a port that is not currently used before starting `npx proteum dev --session-file <path> --port <port>`. After the server is ready, print the live server URL as a clickable Markdown link.
|
|
16
|
+
- Use `--replace-existing` only when restarting the exact session file started by the current thread/task. Never replace another live session that belongs to a user, another thread, or an unknown owner.
|
|
17
|
+
- Only the bare `npx proteum build` and bare `npx proteum dev` commands print the welcome banner and active Proteum installation method. Any extra argument or option skips the banner. Only `npx proteum dev` clears the interactive terminal before rendering and reports connected app names plus successful connected `/ping` checks in the ready banner; keep that in mind when capturing or comparing command logs during diagnosis.
|
|
18
|
+
- For ownership or repo discovery questions, start with `npx proteum orient <query>` instead of jumping straight into source searches.
|
|
17
19
|
- For request-time issues in dev, start with `npx proteum diagnose <path> --port <port>` when you have a concrete failing route, page, controller path, or request target. It combines owner lookup, manifest diagnostics, contract diagnostics, matching trace data, and buffered server logs in one pass.
|
|
20
|
+
- Prefer focused verification before global checks: `npx proteum verify owner <query>`, `npx proteum verify request <path>`, and only then `npx proteum verify browser <path>` or targeted Playwright when the bug is browser-visible.
|
|
21
|
+
- When diagnosing a consumer app that depends on local `file:` connected projects, boot every connected producer app too, each on its own free port and task-scoped session file, and run every one of those `proteum dev` processes with elevated permissions outside the sandbox before reproducing the consumer issue.
|
|
18
22
|
- For connected-project failures, confirm the consumer app resolves the expected `connect.<Namespace>.source` and `connect.<Namespace>.urlInternal` values, the producer app exposes `GET /api/__proteum/connected/ping`, and the imported controller entries show `scope=connected` in `proteum explain`.
|
|
19
23
|
- Use `npx proteum explain owner <query>` when you need a fast ownership graph for a route, controller path, source file, or generated artifact before reading code.
|
|
20
|
-
- For performance issues or regressions in dev, use `npx proteum perf top --since <window>` to rank hot paths, `npx proteum perf request <requestId|path>` for one request waterfall, `npx proteum perf compare --baseline <window> --target <window>` for regressions, and `npx proteum perf memory --since <window>` for heap or RSS drift.
|
|
24
|
+
- For performance issues or regressions in dev, use `npx proteum perf top --since <window>` to rank hot paths, `npx proteum perf request <requestId|path>` for one request waterfall plus chain attribution and SQL fingerprints, `npx proteum perf compare --baseline <window> --target <window>` for regressions, and `npx proteum perf memory --since <window>` for heap or RSS drift.
|
|
21
25
|
- For bundle-size inspection, use `npx proteum build --prod --analyze` to emit `bin/bundle-analysis/client.html` and `client-stats.json`, or add `--analyze-serve --analyze-port auto` when you want a local analyzer URL instead of a static HTML file.
|
|
22
26
|
- For request-time issues in dev, inspect traces before adding logs when the diagnose surface is still too coarse.
|
|
23
27
|
- If a server is already running on the default port from `PORT` or `./.proteum/manifest.json`, inspect existing traces before reproducing the issue.
|
|
24
28
|
- If existing traces are insufficient, arm `npx proteum trace arm --capture deep`, reproduce once, then inspect the new request with `npx proteum trace latest` or `npx proteum trace show <requestId>`.
|
|
25
29
|
- Inspect browser console errors and warnings for frontend, SSR, hydration, and controller-call issues.
|
|
26
30
|
- Inspect server startup and runtime errors.
|
|
27
|
-
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` over driving the login UI. Use the login UI only when auth UX itself is under test.
|
|
31
|
+
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` over driving the login UI. Feed that auth into `npx proteum verify browser ...` or direct Playwright. Use the login UI only when auth UX itself is under test.
|
|
28
32
|
|
|
29
33
|
## Temporary Instrumentation
|
|
30
34
|
|
|
31
35
|
- When manifest inspection, trace data, browser console output, and server errors are still insufficient, add temporary targeted logs in the code to confirm control flow, payload shape, query shape, or branch selection.
|
|
36
|
+
- If SQL is needed during diagnosis, keep it read-only. Never use SQL to change database structure or execute schema-mutating DDL.
|
|
32
37
|
- Keep temporary logs narrow, contextual, and easy to remove. Do not leave broad debug noise in shared execution paths.
|
|
33
38
|
- Re-run only the smallest relevant repro, request, or test after adding temporary instrumentation.
|
|
34
39
|
- Temporary logs added in the code for diagnosis must be cleaned at the end of tests or the repro cycle and must never be committed.
|
|
@@ -36,6 +41,7 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
36
41
|
## Error Solving
|
|
37
42
|
|
|
38
43
|
- Fix the contract boundary, not only the downstream symptom.
|
|
44
|
+
- Treat provider, SSR/client-only hook, router-context, and connected-boundary failures as contract mistakes first. The likely fix is where the boundary was crossed incorrectly, not only where the throw surfaced.
|
|
39
45
|
- Prefer explicit typed schemas, adapters, query `select`s, and narrow response shapes over casts, broad payloads, or hidden fallbacks.
|
|
40
46
|
- Keep patches narrow, then verify immediately at the failing layer before broadening the test surface.
|
|
41
47
|
- Review the resulting diff to confirm the fix removed the cause instead of masking it.
|
|
@@ -43,13 +49,16 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
43
49
|
## Verification And Testing
|
|
44
50
|
|
|
45
51
|
- Use the cheapest trustworthy verification that matches the failing layer.
|
|
46
|
-
- After implementing a
|
|
47
|
-
- For compile-time or type-safety issues, start with the relevant typecheck or build command.
|
|
52
|
+
- After implementing a change, verify only at the smallest trustworthy layer required by the changed surface. Do not default to a running app, project-wide typecheck, `npx proteum check`, or Playwright when a narrower static or request-level verification is enough.
|
|
53
|
+
- For compile-time or type-safety issues, start with the relevant targeted typecheck or build command. Do not run them by default for unrelated runtime, copy, docs, or local refactor changes.
|
|
48
54
|
- For request/runtime issues, verify through the real page, route, generated controller call, or command on a running app.
|
|
49
|
-
- Start the smallest trustworthy runtime surface first:
|
|
50
|
-
-
|
|
55
|
+
- Start the smallest trustworthy runtime surface first: `npx proteum orient <query>`, then the relevant real URL, generated controller call, command, or `npx proteum diagnose <path> --port <port>`. Add targeted Playwright coverage only when request-level verification is insufficient or the change is browser-visible.
|
|
56
|
+
- Proteum does not provide a dedicated raw browser-runtime CLI. When `npx proteum verify browser` is insufficient, use direct Playwright with a disposable profile. Do not launch raw browser automation against a shared persistent profile.
|
|
57
|
+
- Focused verification should treat unrelated global diagnostics as visible but non-blocking by default. Use `--strict-global` only when the task explicitly requires broad clean-room validation.
|
|
58
|
+
- For browser regressions, prefer a real browser repro first and add targeted Playwright coverage only when the user asks for automated coverage, when a stable regression path needs automation, or when manual/browser verification is insufficient.
|
|
59
|
+
- Only the final verifier agent should usually run browser flows. Earlier agents should stay on `orient`, `verify owner`, `verify request`, `diagnose`, and command-level checks unless browser execution is the only trustworthy reproducer.
|
|
51
60
|
- Treat server startup failures, runtime errors, browser console errors or warnings, and Playwright failures as blocking unless they are clearly unrelated to the change.
|
|
52
|
-
- When the touched surface can affect coding-style enforcement, run the smallest relevant
|
|
61
|
+
- When the touched surface can affect coding-style enforcement, run the smallest relevant static check. Do not default to `npx proteum check`; prefer a narrower lint or type check only when the changed surface or an observed issue calls for it.
|
|
53
62
|
- If the task started any long-lived `proteum dev` server, stop it explicitly with `npx proteum dev stop --session-file <path>` or `npx proteum dev stop --all --stale`, then confirm the remaining tracked sessions with `npx proteum dev list --json`.
|
|
54
63
|
- Add `data-testid` when stable selectors are missing instead of relying on brittle text or DOM-shape selectors.
|
|
55
64
|
- If an isolated test misses prerequisite state, run the smallest broader scope that reproduces the real setup.
|
|
@@ -22,12 +22,11 @@ When tradeoffs exist inside optimization work, optimize in this order:
|
|
|
22
22
|
|
|
23
23
|
## SSR And Page Size
|
|
24
24
|
|
|
25
|
-
- SSR page data belongs in page `
|
|
26
|
-
-
|
|
27
|
-
- `
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- Controller fetchers and promises returned from `setup` resolve before render.
|
|
25
|
+
- SSR page data belongs in the explicit `Router.page(path, options, data, render)` `data` function, not in `api.fetch(...)`.
|
|
26
|
+
- `options` carries route behavior. `data` returns one flat object or is `null` when the page has no SSR data loader.
|
|
27
|
+
- Route-option keys and `_`-prefixed route-option aliases are forbidden in page data and must live in `options`.
|
|
28
|
+
- If a page needs route data, return it from `data` and read it in `render`.
|
|
29
|
+
- Controller fetchers and promises returned from `data` resolve before render.
|
|
31
30
|
- Never use `api.fetch(...)` in page files for SSR loading.
|
|
32
31
|
- Synchronous or SSR data calls must return only the strictly necessary data for the current render path to minimize SSR payload size.
|
|
33
32
|
- If an existing controller or data method returns a broader shape than the SSR path needs, create a dedicated proxy controller method with a narrower typed contract instead of reusing the oversized payload.
|