proteum 2.2.2 → 2.2.6
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 +5 -5
- package/README.md +4 -1
- package/agents/project/AGENTS.md +9 -8
- package/agents/project/diagnostics.md +10 -8
- package/agents/project/optimizations.md +2 -2
- package/agents/project/root/AGENTS.md +8 -7
- package/agents/project/tests/AGENTS.md +3 -2
- package/cli/app/index.ts +19 -9
- package/cli/commands/check.ts +7 -3
- package/cli/commands/configure.ts +14 -9
- package/cli/commands/e2e.ts +204 -0
- package/cli/commands/typecheck.ts +7 -3
- package/cli/presentation/commands.ts +37 -7
- package/cli/runtime/command.ts +2 -2
- package/cli/runtime/commands.ts +59 -0
- package/cli/scaffold/index.ts +1 -1
- package/cli/utils/agents.ts +175 -80
- package/cli/utils/check.ts +32 -4
- package/docs/dev-sessions.md +11 -2
- package/docs/diagnostics.md +2 -1
- package/package.json +1 -1
- package/scripts/update-codex-agents.ts +2 -2
- package/server/services/router/request/index.ts +2 -1
- package/server/services/router/request/ip.test.cjs +60 -0
- package/server/services/router/request/ip.ts +71 -0
package/AGENTS.md
CHANGED
|
@@ -25,13 +25,13 @@ After those optimization concerns, preserve explicit, typed, machine-readable co
|
|
|
25
25
|
|
|
26
26
|
## Workflow
|
|
27
27
|
|
|
28
|
-
- If the user pastes raw errors without asking for a fix, do not implement changes.
|
|
28
|
+
- If the user pastes raw errors without asking for a fix, do not implement changes yet. First run the task-safe local reproduction path: identify the likely app, route, command, or request from the error, boot or reuse the relevant dev server with the elevated-permissions workflow below, reproduce the failing surface locally, and inspect server output, browser console output, diagnostics, traces, or the smallest relevant command result. If the error does not identify enough context to reproduce, say what is missing and use the available local evidence before guessing. Then list likely causes and, for each one, give probability, why, and how to fix it.
|
|
29
29
|
- If you changed any app `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
30
|
```
|
|
31
31
|
cd <worktree path>
|
|
32
32
|
npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
|
|
33
33
|
```
|
|
34
|
-
- After implementing a framework feature or change, do not stop at code edits. Boot both reference apps, exercise
|
|
34
|
+
- After implementing a framework feature or change, do not stop at code edits. Boot both reference apps, exercise browser-visible flows with the browser MCP or use 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.
|
|
35
35
|
- When starting a long-lived reference app dev server for framework work, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit thread-scoped session file such as `var/run/proteum/dev/framework-<app>-<task>.json`, inspect tracked sessions plus current listeners first, for example with `npx proteum dev list --json` and `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 such as `[http://localhost:3100](http://localhost:3100)`.
|
|
36
36
|
- Do not use `--replace-existing` unless you are 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.
|
|
37
37
|
- When a reference app uses local `file:` connected projects for the affected flow, boot every connected producer app as well, each on its own free port and thread-scoped session file, and run every one of those `proteum dev` processes with elevated permissions outside the sandbox before starting or validating the consumer app.
|
|
@@ -82,12 +82,12 @@ Do not stop at static analysis for routing, controllers, generated code, SSR, cl
|
|
|
82
82
|
- 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.
|
|
83
83
|
- 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.
|
|
84
84
|
- When a framework change can affect shipped client code size, run `proteum build --prod --analyze` for static bundle artifacts or `proteum build --prod --analyze --analyze-serve --analyze-port auto` when you need a local analyzer URL.
|
|
85
|
-
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>`
|
|
86
|
-
- When a task needs browser execution instead of the higher-level verifier,
|
|
85
|
+
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` for browser MCP validation, or `npx proteum e2e --session-email <email> --session-role <role>` for automated end-to-end suites, instead of automating the login UI. Use the login UI only when login itself is the feature under test.
|
|
86
|
+
- When a task needs browser execution instead of the higher-level verifier, use the browser MCP. Keep Playwright inside `npx proteum e2e --port <port>` for targeted or full end-to-end suites. Keep auth sourced from Proteum session helpers, not UI login or shared browser state.
|
|
87
87
|
- For request-time behavior, arm traces with `proteum trace arm --capture deep`, reproduce once, then inspect `proteum trace latest` or `proteum trace show <requestId>`.
|
|
88
88
|
- 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>`.
|
|
89
89
|
- Only the final verifier agent should usually run browser flows. Other agents should stay on `orient`, `verify owner`, `verify request`, and command-level checks unless browser execution is the only trustworthy surface.
|
|
90
|
-
- Open the real pages with
|
|
90
|
+
- Open the real pages with the browser MCP.
|
|
91
91
|
- Inspect browser console errors and warnings.
|
|
92
92
|
- Inspect server startup and runtime errors.
|
|
93
93
|
|
package/README.md
CHANGED
|
@@ -344,6 +344,7 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
|
|
|
344
344
|
| `proteum trace` | Inspect live dev-only request traces from the running SSR server |
|
|
345
345
|
| `proteum command` | Run a dev-only internal command locally or against a running dev server |
|
|
346
346
|
| `proteum session` | Mint a dev-only auth session token and Playwright-ready cookie payload |
|
|
347
|
+
| `proteum e2e` | Run Playwright with Proteum-managed `E2E_*` values instead of shell-leading env assignments |
|
|
347
348
|
| `proteum verify` | Validate framework-facing workflows across one or more running dev apps; `framework-change` is the built-in cross-reference-app check |
|
|
348
349
|
| `proteum init` | Scaffold a new Proteum app with built-in deterministic templates |
|
|
349
350
|
| `proteum configure agents` | Interactively configure Proteum-managed instruction symlinks and confirm overwrites for standalone or monorepo apps |
|
|
@@ -386,6 +387,7 @@ proteum command proteum/diagnostics/ping
|
|
|
386
387
|
proteum command proteum/diagnostics/ping --port 3101
|
|
387
388
|
proteum session admin@example.com --role ADMIN --port 3101
|
|
388
389
|
proteum session god@example.com --role GOD --json
|
|
390
|
+
proteum e2e --port 3101 --session-email admin@example.com --session-role ADMIN tests/e2e/features/admin.spec.ts
|
|
389
391
|
proteum trace requests
|
|
390
392
|
proteum trace arm --capture deep
|
|
391
393
|
proteum trace latest
|
|
@@ -523,6 +525,7 @@ Proteum answers those questions with explicit artifacts:
|
|
|
523
525
|
- the profiler `Explain`, `Doctor`, `Diagnose`, and `Perf` tabs for a human-readable view over the same diagnostics and trace-derived perf contracts
|
|
524
526
|
- `proteum command ...` plus the profiler `Commands` tab for dev-only internal execution
|
|
525
527
|
- `proteum session ...` for explicit authenticated dev browser or API bootstrapping without login UI automation
|
|
528
|
+
- `proteum e2e ...` for Playwright runs that need `E2E_BASE_URL`, `E2E_PORT`, or `E2E_AUTH_TOKEN` without shell-leading env assignments
|
|
526
529
|
|
|
527
530
|
If you are an LLM or automation agent, start here:
|
|
528
531
|
|
|
@@ -533,7 +536,7 @@ If you are an LLM or automation agent, start here:
|
|
|
533
536
|
5. Inspect `server/controllers/**` for request entrypoints.
|
|
534
537
|
6. Inspect `server/services/**` for business logic.
|
|
535
538
|
7. Inspect `client/pages/**` for SSR routes and page data contracts.
|
|
536
|
-
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>`
|
|
539
|
+
8. If the task touches a protected route or controller in dev and login UX is not the feature under test, use `proteum e2e --session-email <email> --session-role <role>` for Playwright suites or `proteum session <email> --role <role>` before direct HTTP calls.
|
|
537
540
|
|
|
538
541
|
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.
|
|
539
542
|
|
package/agents/project/AGENTS.md
CHANGED
|
@@ -18,8 +18,8 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
18
18
|
- Read and acknowledge the applicable `AGENTS.md` files.
|
|
19
19
|
- Run `npm i`.
|
|
20
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.
|
|
22
|
-
- test, re-run analysis and give a
|
|
21
|
+
- If the user pastes raw errors without asking for a fix, do not implement changes yet. First run the task-safe local reproduction path: identify the likely app, route, command, or request from the error, boot or reuse the relevant dev server with the elevated-permissions workflow in `Task Lifecycle`, reproduce the failing surface locally, and inspect server output, browser console output, diagnostics, traces, or the smallest relevant command result. If the error does not identify enough context to reproduce, say what is missing and use the available local evidence before guessing. Then list likely causes and, for each one, give probability, why, and how to fix it. After this, every time you implement a fix:
|
|
22
|
+
- test, re-run analysis and give a comparison table of before and after
|
|
23
23
|
- re-print the complete list of suggested fixes, but strike the ones we already implemented or not necessary anymore
|
|
24
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
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`.
|
|
@@ -56,13 +56,14 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
56
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
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
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
|
|
59
|
+
- For browser validation, use the browser MCP against the running app. Keep Playwright inside `npx proteum e2e --port <port>` for targeted/full end-to-end suites. Bootstrap protected browser MCP state with `npx proteum session`; bootstrap protected E2E runs with `npx proteum e2e --session-email <email> --session-role <role>`.
|
|
60
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. When the app root is missing `AGENTS.md`, the bare interactive `proteum dev` start offers to launch `proteum configure agents` before the dev loop begins.
|
|
61
61
|
|
|
62
62
|
### Before Finishing
|
|
63
63
|
|
|
64
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
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
|
+
- After implementing UI-visible changes, once the required tests or verification pass, use the browser MCP to open the changed routes or states, capture screenshots focused on the changed areas, inspect them for obvious visual defects, and include or reference those screenshots in the final response as proof of the completed UI change.
|
|
66
67
|
- 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
68
|
- 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
69
|
`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.`
|
|
@@ -175,12 +176,13 @@ Verify at the correct layer:
|
|
|
175
176
|
- Default: use the cheapest trustworthy verification for the changed surface first, then escalate only if the changed surface justifies it.
|
|
176
177
|
- Route additions: boot the app and hit the real URL.
|
|
177
178
|
- 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
|
+
- SSR changes: use the browser MCP to load the real page and inspect rendered HTML plus browser console.
|
|
179
180
|
- 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
|
+
- New features or feature-behavior changes: use the cheapest trustworthy verification while iterating, use the browser MCP for browser-visible validation, then update the relevant end-to-end coverage and finish by running the full Playwright suite.
|
|
182
|
+
- UI-visible changes: after the required tests or verification, use the browser MCP to screenshot the changed areas and confirm the screenshots match the intended result.
|
|
181
183
|
- 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:
|
|
183
|
-
- Raw browser execution
|
|
184
|
+
- Browser-visible issues: use the browser MCP after request-level verification is insufficient. Use `npx proteum e2e --port <port> ...` only when automated end-to-end coverage or a Playwright suite is required.
|
|
185
|
+
- Raw browser execution outside end-to-end suites: use the browser MCP only. Keep Playwright in `npx proteum e2e --port <port>` for targeted/full end-to-end suites.
|
|
184
186
|
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
|
|
185
187
|
|
|
186
188
|
## Implementation Rules
|
|
@@ -281,7 +283,6 @@ Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
|
281
283
|
- `npx proteum diagnose <path> --port <port>`
|
|
282
284
|
- `npx proteum verify owner <query>`
|
|
283
285
|
- `npx proteum verify request <path>`
|
|
284
|
-
- `npx proteum verify browser <path>`
|
|
285
286
|
- `npx proteum perf ...`
|
|
286
287
|
- `npx proteum trace ...`
|
|
287
288
|
- `npx proteum command ...`
|
|
@@ -5,6 +5,7 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
5
5
|
## Initial Triage
|
|
6
6
|
|
|
7
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
|
+
- When the user pastes raw errors, reproduce locally before listing possible causes: identify the likely app, route, command, or request target from the error, boot or reuse the relevant dev server with the elevated-permissions workflow below, replay the failing surface once, and base the probability/why/how-to-fix list on local server output, browser console output, diagnostics, traces, or the smallest relevant command result. If there is not enough information to reproduce, state the missing context and ground the cause list in the local evidence that is available.
|
|
8
9
|
- 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
10
|
- Use `rg -n` first to narrow the exact code path, then read only the relevant files.
|
|
10
11
|
- Inspect `./server/index.ts`, `./server/config/*.ts`, and the touched files under `./commands`, `./server/controllers`, `./server/services`, `./server/routes`, `./client/pages`, and `./tests`.
|
|
@@ -17,7 +18,7 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
17
18
|
- 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. When the app root is missing `AGENTS.md`, the bare interactive `npx proteum dev` start offers to launch `npx proteum configure agents` before the dev loop begins.
|
|
18
19
|
- For ownership or repo discovery questions, start with `npx proteum orient <query>` instead of jumping straight into source searches.
|
|
19
20
|
- 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
|
|
21
|
+
- Prefer focused verification before global checks: `npx proteum verify owner <query>`, `npx proteum verify request <path>`, and only then browser MCP validation when the bug is browser-visible. Use `npx proteum e2e --port <port> ...` only when automated end-to-end coverage or a Playwright suite is required.
|
|
21
22
|
- 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.
|
|
22
23
|
- 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`.
|
|
23
24
|
- 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.
|
|
@@ -26,9 +27,9 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
26
27
|
- For request-time issues in dev, inspect traces before adding logs when the diagnose surface is still too coarse.
|
|
27
28
|
- If a server is already running on the default port from `PORT` or `./.proteum/manifest.json`, inspect existing traces before reproducing the issue.
|
|
28
29
|
- 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>`.
|
|
29
|
-
-
|
|
30
|
+
- Use the browser MCP to inspect browser console errors and warnings for frontend, SSR, hydration, and controller-call issues.
|
|
30
31
|
- Inspect server startup and runtime errors.
|
|
31
|
-
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` over driving the login UI
|
|
32
|
+
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` over driving the login UI, then use that session for browser MCP validation. Use `npx proteum e2e --session-email <email> --session-role <role>` only when Playwright end-to-end suites need the auth token through the child process environment. Use the login UI only when auth UX itself is under test.
|
|
32
33
|
|
|
33
34
|
## Temporary Instrumentation
|
|
34
35
|
|
|
@@ -49,17 +50,18 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
49
50
|
## Verification And Testing
|
|
50
51
|
|
|
51
52
|
- Use the cheapest trustworthy verification that matches the failing layer.
|
|
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
|
+
- After implementing a change, verify only at the smallest trustworthy layer required by the changed surface. Do not default to a running app, browser MCP, project-wide typecheck, `npx proteum check`, or Playwright when a narrower static or request-level verification is enough.
|
|
53
54
|
- 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.
|
|
54
55
|
- For request/runtime issues, verify through the real page, route, generated controller call, or command on a running app.
|
|
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>`.
|
|
56
|
-
-
|
|
56
|
+
- 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>`. Use browser MCP validation only when request-level verification is insufficient or the change is browser-visible.
|
|
57
|
+
- When automated browser assertions or suite coverage are required, use `npx proteum e2e --port <port>` for targeted or full Playwright suites. Do not use direct Playwright for browser validation outside the E2E wrapper, and do not launch raw browser automation against a shared persistent profile.
|
|
57
58
|
- 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
|
|
59
|
+
- For browser regressions, prefer a browser MCP repro first and add targeted Playwright E2E coverage only when the user asks for automated coverage, when a stable regression path needs automation, or when browser MCP verification is insufficient.
|
|
60
|
+
- For UI-visible fixes, after the required tests or verification pass, use the browser MCP to capture focused screenshots of the changed areas and inspect them before finalizing.
|
|
59
61
|
- 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.
|
|
60
62
|
- Treat server startup failures, runtime errors, browser console errors or warnings, and Playwright failures as blocking unless they are clearly unrelated to the change.
|
|
61
63
|
- 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.
|
|
62
64
|
- 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`.
|
|
63
65
|
- Add `data-testid` when stable selectors are missing instead of relying on brittle text or DOM-shape selectors.
|
|
64
66
|
- If an isolated test misses prerequisite state, run the smallest broader scope that reproduces the real setup.
|
|
65
|
-
- After a fix, re-check traces, rendered HTML, browser console, and server output when those surfaces were part of the original failure.
|
|
67
|
+
- After a fix, re-check traces, rendered HTML, browser console through the browser MCP, and server output when those surfaces were part of the original failure.
|
|
@@ -42,7 +42,7 @@ When tradeoffs exist inside optimization work, optimize in this order:
|
|
|
42
42
|
- Do not stop at static analysis for SSR, routing, emitted assets, or rendered HTML.
|
|
43
43
|
- After implementing a feature or change, verify that performance, load size, and SEO output did not materially regress before finishing.
|
|
44
44
|
- When runtime cost, hot paths, or memory can change, use the relevant `npx proteum perf ...` command against the affected request or route and compare to the pre-change behavior when possible.
|
|
45
|
-
- For browser or SSR changes, load the real page, inspect the rendered HTML, and confirm the change does not ship unnecessary client code or oversized SSR payloads.
|
|
45
|
+
- For browser or SSR changes, use the browser MCP to load the real page, inspect the rendered HTML, and confirm the change does not ship unnecessary client code or oversized SSR payloads.
|
|
46
46
|
- Treat clearly worse bundle size, runtime cost, or crawlable HTML quality as regressions to fix or justify explicitly, not as optional follow-up cleanup.
|
|
47
47
|
- Build-only checks are supplementary.
|
|
48
|
-
- For SSR changes, load the real page and inspect the rendered HTML plus browser console.
|
|
48
|
+
- For SSR changes, use the browser MCP to load the real page and inspect the rendered HTML plus browser console.
|
|
@@ -11,7 +11,7 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
11
11
|
|
|
12
12
|
## Fast Triggers
|
|
13
13
|
|
|
14
|
-
- If the user pastes raw errors without asking for a fix, do not implement changes.
|
|
14
|
+
- If the user pastes raw errors without asking for a fix, do not implement changes yet. First run the task-safe local reproduction path: identify the likely app, route, command, or request from the error, boot or reuse the relevant dev server with the elevated-permissions workflow in `Task Lifecycle`, reproduce the failing surface locally, and inspect server output, browser console output, diagnostics, traces, or the smallest relevant command result. If the error does not identify enough context to reproduce, say what is missing and use the available local evidence before guessing. Then list likely causes and, for each one, give probability, why, and how to fix it.
|
|
15
15
|
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>` before reading large parts of the codebase.
|
|
16
16
|
- 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`.
|
|
17
17
|
- 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.
|
|
@@ -46,13 +46,14 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
46
46
|
- 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.
|
|
47
47
|
- 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.
|
|
48
48
|
- 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.
|
|
49
|
-
- For
|
|
49
|
+
- For browser validation, use the browser MCP against the running app. Keep Playwright inside `npx proteum e2e --port <port>` for targeted/full end-to-end suites. Bootstrap protected browser MCP state with `npx proteum session`; bootstrap protected E2E runs with `npx proteum e2e --session-email <email> --session-role <role>`.
|
|
50
50
|
- 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. When the app root is missing `AGENTS.md`, the bare interactive `proteum dev` start offers to launch `proteum configure agents` before the dev loop begins.
|
|
51
51
|
|
|
52
52
|
### Before Finishing
|
|
53
53
|
|
|
54
54
|
- 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.
|
|
55
55
|
- 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.
|
|
56
|
+
- After implementing UI-visible changes, once the required tests or verification pass, use the browser MCP to open the changed routes or states, capture screenshots focused on the changed areas, inspect them for obvious visual defects, and include or reference those screenshots in the final response as proof of the completed UI change.
|
|
56
57
|
- 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>`.
|
|
57
58
|
- 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:
|
|
58
59
|
`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.`
|
|
@@ -165,12 +166,13 @@ Verify at the correct layer:
|
|
|
165
166
|
- Default: use the cheapest trustworthy verification for the changed surface first, then escalate only if the changed surface justifies it.
|
|
166
167
|
- Route additions: boot the app and hit the real URL.
|
|
167
168
|
- Controller changes: exercise the generated client call or generated `/api/...` endpoint.
|
|
168
|
-
- SSR changes: load the real page and inspect rendered HTML plus browser console.
|
|
169
|
+
- SSR changes: use the browser MCP to load the real page and inspect rendered HTML plus browser console.
|
|
169
170
|
- Router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app.
|
|
170
|
-
- 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.
|
|
171
|
+
- New features or feature-behavior changes: use the cheapest trustworthy verification while iterating, use the browser MCP for browser-visible validation, then update the relevant end-to-end coverage and finish by running the full Playwright suite.
|
|
172
|
+
- UI-visible changes: after the required tests or verification, use the browser MCP to screenshot the changed areas and confirm the screenshots match the intended result.
|
|
171
173
|
- Generated, connected, or ownership-ambiguous changes: start with `npx proteum orient <query>` and prefer `npx proteum verify owner <query>` before broad global checks.
|
|
172
|
-
- Browser-visible issues:
|
|
173
|
-
- Raw browser execution
|
|
174
|
+
- Browser-visible issues: use the browser MCP after request-level verification is insufficient. Use `npx proteum e2e --port <port> ...` only when automated end-to-end coverage or a Playwright suite is required.
|
|
175
|
+
- Raw browser execution outside end-to-end suites: use the browser MCP only. Keep Playwright in `npx proteum e2e --port <port>` for targeted/full end-to-end suites.
|
|
174
176
|
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
|
|
175
177
|
|
|
176
178
|
## Implementation Rules
|
|
@@ -271,7 +273,6 @@ Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
|
271
273
|
- `npx proteum diagnose <path> --port <port>`
|
|
272
274
|
- `npx proteum verify owner <query>`
|
|
273
275
|
- `npx proteum verify request <path>`
|
|
274
|
-
- `npx proteum verify browser <path>`
|
|
275
276
|
- `npx proteum perf ...`
|
|
276
277
|
- `npx proteum trace ...`
|
|
277
278
|
- `npx proteum command ...`
|
|
@@ -10,7 +10,8 @@ Diagnostics source of truth: root-level `diagnostics.md`.
|
|
|
10
10
|
- Understand the real user flow and the main feature branches before writing tests.
|
|
11
11
|
- Test the current controller/page runtime model, not legacy `@Route` or `api.fetch(...)` behavior.
|
|
12
12
|
- Verify routing, controllers, SSR, and router plugins against a running app when behavior depends on real request handling.
|
|
13
|
-
- After implementing a new feature or changing existing feature behavior, update the end-to-end coverage for that behavior and run the full Playwright suite before finishing. Use a
|
|
13
|
+
- After implementing a new feature or changing existing feature behavior, update the end-to-end coverage for that behavior and run the full Playwright suite before finishing. Prefer `npx proteum e2e --port <port>` for Playwright runs so base URLs and auth tokens are passed through Proteum-managed child env instead of shell-leading environment assignments. Use a browser MCP repro against a running app during iteration when it is the fastest trustworthy loop.
|
|
14
|
+
- For UI-visible feature changes, after the required Playwright run passes, use the browser MCP to capture focused screenshots of the changed areas and inspect them for visual correctness before finishing.
|
|
14
15
|
- Exercise real URLs, generated controller calls, or real browser flows instead of re-deriving framework internals in tests.
|
|
15
16
|
- Organize end-to-end tests following the Crosspath platform layout under `tests/e2e/**`.
|
|
16
17
|
- Put runnable scenario entrypoints in `tests/e2e/features/**`, `tests/e2e/specs/<domain>/**`, or `tests/e2e/journeys/**` depending on scope.
|
|
@@ -22,4 +23,4 @@ Diagnostics source of truth: root-level `diagnostics.md`.
|
|
|
22
23
|
- Add `data-testid` where needed instead of relying on brittle selectors.
|
|
23
24
|
- Keep end-to-end tests clean, well organized, and non-redundant. Prefer extending or reshaping the most relevant existing scenario over duplicating coverage, and remove or consolidate overlap when the suite becomes repetitive.
|
|
24
25
|
- Reuse root catalog files from `/client/catalogs/**`, `/server/catalogs/**`, or `/common/catalogs/**` instead of duplicating catalog constants in tests.
|
|
25
|
-
- For protected dev flows, prefer `npx proteum session <email> --role <role>` over automating login unless the login flow itself is under test.
|
|
26
|
+
- For protected dev flows, prefer `npx proteum e2e --session-email <email> --session-role <role>` or `npx proteum session <email> --role <role>` over automating login unless the login flow itself is under test.
|
package/cli/app/index.ts
CHANGED
|
@@ -36,6 +36,12 @@ const parseRouterPortOverride = (rawPort: string | boolean | string[] | undefine
|
|
|
36
36
|
|
|
37
37
|
const normalizeModulePath = (value: string) => value.replace(/\\/g, '/').replace(/\/$/, '');
|
|
38
38
|
|
|
39
|
+
const resolveSideTsconfig = (appRoot: string, side: TAppSide) => {
|
|
40
|
+
const candidates = [path.join(appRoot, side, 'tsconfig.json'), path.join(appRoot, side, 'app.tsconfig.json')];
|
|
41
|
+
|
|
42
|
+
return candidates.find((candidate) => fs.existsSync(candidate));
|
|
43
|
+
};
|
|
44
|
+
|
|
39
45
|
const resolveTranspileModuleDirectories = ({
|
|
40
46
|
moduleNames,
|
|
41
47
|
resolvePackageRoot,
|
|
@@ -183,17 +189,21 @@ export class App {
|
|
|
183
189
|
----------------------------------*/
|
|
184
190
|
|
|
185
191
|
public aliases = {
|
|
186
|
-
client:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
192
|
+
client: this.createSideAliases('client'),
|
|
193
|
+
server: this.createSideAliases('server'),
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
private createSideAliases(side: TAppSide) {
|
|
197
|
+
const tsconfigFilepath = resolveSideTsconfig(this.paths.root, side);
|
|
198
|
+
|
|
199
|
+
if (!tsconfigFilepath) return new TsAlias({ aliases: [] });
|
|
200
|
+
|
|
201
|
+
return new TsAlias({
|
|
202
|
+
rootDir: tsconfigFilepath,
|
|
193
203
|
modulesDir: [cli.paths.framework.appNodeModulesRoot, cli.paths.framework.frameworkNodeModulesRoot],
|
|
194
204
|
debug: false,
|
|
195
|
-
})
|
|
196
|
-
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
197
207
|
|
|
198
208
|
private loadPkg() {
|
|
199
209
|
return fs.readJSONSync(this.paths.root + '/package.json');
|
package/cli/commands/check.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cli from '..';
|
|
2
|
-
import { refreshGeneratedTypings, runAppLint, runAppTypecheck } from '../utils/check';
|
|
2
|
+
import { hasAppConfig, refreshGeneratedTypings, runAppLint, runAppTypecheck } from '../utils/check';
|
|
3
3
|
import { renderRows } from '../presentation/layout';
|
|
4
4
|
import { renderStep, renderSuccess, renderTitle } from '../presentation/ink';
|
|
5
5
|
|
|
@@ -23,8 +23,12 @@ export const run = async (): Promise<void> => {
|
|
|
23
23
|
renderRows([{ label: 'app', value: cli.paths.appRoot === process.cwd() ? '.' : cli.paths.appRoot }]),
|
|
24
24
|
].join('\n\n'),
|
|
25
25
|
);
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (hasAppConfig()) {
|
|
27
|
+
console.info(await renderStep('[1/3]', 'Refreshing generated typings.'));
|
|
28
|
+
await refreshGeneratedTypings();
|
|
29
|
+
} else {
|
|
30
|
+
console.info(await renderStep('[1/3]', 'Skipping generated typings: no Proteum app config found.'));
|
|
31
|
+
}
|
|
28
32
|
console.info(await renderStep('[2/3]', 'Running TypeScript typechecking.'));
|
|
29
33
|
await runAppTypecheck();
|
|
30
34
|
console.info(await renderStep('[3/3]', 'Running ESLint.'));
|
|
@@ -13,7 +13,7 @@ import cli from '..';
|
|
|
13
13
|
import { renderRows } from '../presentation/layout';
|
|
14
14
|
import { isLikelyProteumAppRoot } from '../presentation/commands';
|
|
15
15
|
import { renderStep, renderSuccess, renderTitle, renderWarning } from '../presentation/ink';
|
|
16
|
-
import {
|
|
16
|
+
import { configureProjectAgentInstructions, type TConfigureProjectAgentInstructionsResult } from '../utils/agents';
|
|
17
17
|
|
|
18
18
|
/*----------------------------------
|
|
19
19
|
- HELPERS
|
|
@@ -93,7 +93,12 @@ const promptBlockedOverwritePaths = async (blockedPaths: string[]) => {
|
|
|
93
93
|
if (blockedPaths.length === 0) return [];
|
|
94
94
|
|
|
95
95
|
console.info(await renderWarning('Proteum found existing non-managed instruction paths.'));
|
|
96
|
-
console.info(
|
|
96
|
+
console.info(
|
|
97
|
+
[
|
|
98
|
+
'Choose whether to overwrite each path with a Proteum-managed instruction stub:',
|
|
99
|
+
...blockedPaths.map((entry) => `- ${entry}`),
|
|
100
|
+
].join('\n'),
|
|
101
|
+
);
|
|
97
102
|
|
|
98
103
|
const overwriteBlockedPaths: string[] = [];
|
|
99
104
|
|
|
@@ -118,7 +123,7 @@ const promptBlockedOverwritePaths = async (blockedPaths: string[]) => {
|
|
|
118
123
|
return overwriteBlockedPaths;
|
|
119
124
|
};
|
|
120
125
|
|
|
121
|
-
const renderConfigureResultSections = (result:
|
|
126
|
+
const renderConfigureResultSections = (result: TConfigureProjectAgentInstructionsResult) => {
|
|
122
127
|
const sections: string[] = [];
|
|
123
128
|
|
|
124
129
|
sections.push(
|
|
@@ -178,7 +183,7 @@ export const runConfigureAgentsWizard = async ({
|
|
|
178
183
|
: undefined;
|
|
179
184
|
console.info(
|
|
180
185
|
[
|
|
181
|
-
await renderTitle('PROTEUM CONFIGURE AGENTS', 'Configure Proteum-managed instruction
|
|
186
|
+
await renderTitle('PROTEUM CONFIGURE AGENTS', 'Configure Proteum-managed instruction stubs.'),
|
|
182
187
|
renderRows([{ label: 'app', value: appRoot === process.cwd() ? '.' : appRoot }]),
|
|
183
188
|
].join('\n\n'),
|
|
184
189
|
);
|
|
@@ -204,7 +209,7 @@ export const runConfigureAgentsWizard = async ({
|
|
|
204
209
|
})
|
|
205
210
|
: undefined;
|
|
206
211
|
|
|
207
|
-
const preview =
|
|
212
|
+
const preview = configureProjectAgentInstructions({
|
|
208
213
|
appRoot,
|
|
209
214
|
coreRoot,
|
|
210
215
|
dryRun: true,
|
|
@@ -216,12 +221,12 @@ export const runConfigureAgentsWizard = async ({
|
|
|
216
221
|
await renderStep(
|
|
217
222
|
'[1/1]',
|
|
218
223
|
isMonorepo
|
|
219
|
-
? `Writing monorepo-aware instruction
|
|
220
|
-
: 'Writing standalone instruction
|
|
224
|
+
? `Writing monorepo-aware instruction stubs using ${monorepoRoot}.`
|
|
225
|
+
: 'Writing standalone instruction stubs.',
|
|
221
226
|
),
|
|
222
227
|
);
|
|
223
228
|
|
|
224
|
-
const result =
|
|
229
|
+
const result = configureProjectAgentInstructions({
|
|
225
230
|
appRoot,
|
|
226
231
|
coreRoot,
|
|
227
232
|
monorepoRoot,
|
|
@@ -229,7 +234,7 @@ export const runConfigureAgentsWizard = async ({
|
|
|
229
234
|
});
|
|
230
235
|
const sections = renderConfigureResultSections(result);
|
|
231
236
|
|
|
232
|
-
console.info(await renderSuccess('Proteum-managed instruction
|
|
237
|
+
console.info(await renderSuccess('Proteum-managed instruction stubs are configured.'));
|
|
233
238
|
|
|
234
239
|
if (sections.length > 0) console.info(`\n${sections.join('\n\n')}`);
|
|
235
240
|
};
|