proteum 2.2.3 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -6
- package/README.md +4 -4
- package/agents/project/AGENTS.md +11 -9
- package/agents/project/app-root/AGENTS.md +1 -1
- package/agents/project/diagnostics.md +11 -9
- package/agents/project/optimizations.md +2 -2
- package/agents/project/root/AGENTS.md +10 -8
- package/agents/project/tests/AGENTS.md +2 -1
- package/cli/commands/configure.ts +14 -35
- package/cli/commands/dev.ts +105 -52
- package/cli/compiler/artifacts/manifest.ts +1 -5
- package/cli/presentation/commands.ts +9 -9
- package/cli/presentation/help.ts +1 -1
- package/cli/scaffold/index.ts +2 -5
- package/cli/scaffold/templates.ts +1 -7
- package/cli/utils/agents.ts +281 -199
- package/package.json +1 -1
- package/server/services/router/request/index.ts +1 -18
- package/server/services/router/request/ip.test.cjs +60 -0
- package/server/services/router/request/ip.ts +71 -0
- package/tests/agents-utils.test.cjs +207 -0
- package/tests/dev-transpile-watch.test.cjs +513 -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.
|
|
@@ -58,7 +58,7 @@ npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
|
|
|
58
58
|
- Inspect how both apps currently use the touched feature, runtime, API, compiler behavior, or generated output before proposing or implementing changes.
|
|
59
59
|
- Keep the developer-facing contract synchronized when framework work changes CLI commands, profiler capabilities, or the `proteum dev` banner. Update the live surfaces together in the same pass: CLI command/help definitions, profiler panels and dev-only endpoints, banner text/examples, and the most relevant agent docs that describe them, especially `AGENTS.md`, `agents/project/AGENTS.md`, `agents/project/root/AGENTS.md`, `agents/project/app-root/AGENTS.md`, `agents/project/diagnostics.md`, and any narrower `agents/project/**/AGENTS.md` file that mentions the changed workflow.
|
|
60
60
|
- Keep the same-system trace contract explicit when request instrumentation changes: `TRACE_*` controls the retained dev trace store plus the trace/perf CLI, dev-only HTTP endpoints, and bottom profiler, while `ENABLE_PROFILER` enables the reduced request-local `request.profiling` snapshot and `request.finished` hook payload without retaining finished requests globally unless dev trace is also enabled.
|
|
61
|
-
- 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.
|
|
61
|
+
- 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. Every `proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
62
62
|
- Keep core changes aligned with the explicit controller/page architecture in `agents/project/root/AGENTS.md` and its standalone composition in `agents/project/AGENTS.md`.
|
|
63
63
|
- Prefer removing framework magic when the same result can be expressed with explicit contracts, generated code, or typed context.
|
|
64
64
|
- Apply the pruning rules from `agents/project/optimizations.md`, especially for webpack plugins, Babel plugins, aliases, helpers, runtime services, and npm packages that are not meaningfully used by both apps.
|
|
@@ -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>` or `npx proteum e2e --session-email <email> --session-role <role>` 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,
|
|
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
|
@@ -347,7 +347,7 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
|
|
|
347
347
|
| `proteum e2e` | Run Playwright with Proteum-managed `E2E_*` values instead of shell-leading env assignments |
|
|
348
348
|
| `proteum verify` | Validate framework-facing workflows across one or more running dev apps; `framework-change` is the built-in cross-reference-app check |
|
|
349
349
|
| `proteum init` | Scaffold a new Proteum app with built-in deterministic templates |
|
|
350
|
-
| `proteum configure agents` | Interactively configure Proteum
|
|
350
|
+
| `proteum configure agents` | Interactively configure tracked Proteum instruction files for standalone or monorepo apps |
|
|
351
351
|
| `proteum create` | Scaffold a page, controller, command, route, or root service inside an app |
|
|
352
352
|
|
|
353
353
|
Recommended daily workflow:
|
|
@@ -361,7 +361,7 @@ proteum build --prod --analyze
|
|
|
361
361
|
proteum build --prod --analyze --analyze-serve --analyze-port auto
|
|
362
362
|
```
|
|
363
363
|
|
|
364
|
-
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. `proteum dev` is the only command that clears the interactive terminal before rendering its live session UI, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys, and prints connected app names plus successful connected `/ping` checks in the server-ready banner.
|
|
364
|
+
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. `proteum dev` is the only command that clears the interactive terminal before rendering its live session UI, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys, and prints connected app names plus successful connected `/ping` checks in the server-ready banner. Every `proteum dev` start ensures tracked Proteum instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
365
365
|
|
|
366
366
|
Useful inspection commands:
|
|
367
367
|
|
|
@@ -404,9 +404,9 @@ proteum create controller Founder/projects --method list
|
|
|
404
404
|
proteum create service Conversion/Plans
|
|
405
405
|
```
|
|
406
406
|
|
|
407
|
-
`proteum configure agents`
|
|
407
|
+
`proteum configure agents` embeds the full Proteum project instruction corpus into the managed `# Proteum Instructions` section of each tracked instruction file. It preserves content outside that section and asks before replacing directories or foreign symlinks. If you decline, that path is left untouched.
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
Every `proteum dev` start runs the same idempotent instruction check. It updates missing or stale managed sections automatically and prompts only when a blocked path would need to be replaced.
|
|
410
410
|
|
|
411
411
|
`proteum connect`, `proteum explain`, `proteum doctor`, and `proteum diagnose` share the same generated manifest and contract state. `proteum perf` uses the same dev request-trace store as the profiler `Perf` tab. For the full diagnostics and tracing model, see [docs/diagnostics.md](docs/diagnostics.md) and [docs/request-tracing.md](docs/request-tracing.md).
|
|
412
412
|
|
package/agents/project/AGENTS.md
CHANGED
|
@@ -18,9 +18,10 @@ 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
|
+
- If the user asks to implement a feature, first inspect the relevant existing surface and state any implementation problem, pain point, attention point, or question you see. If a concern is blocking, or it can materially change product behavior, API shape, architecture, data model, cost, privacy, security, or UX, ask before editing; otherwise state the assumption and continue implementing.
|
|
24
25
|
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>` before reading large parts of the codebase.
|
|
25
26
|
- 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
27
|
- 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.
|
|
@@ -56,13 +57,14 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
56
57
|
- 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
58
|
- 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
59
|
- 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
|
|
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.
|
|
60
|
+
- 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>`.
|
|
61
|
+
- 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. Every `proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
61
62
|
|
|
62
63
|
### Before Finishing
|
|
63
64
|
|
|
64
65
|
- 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
66
|
- 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.
|
|
67
|
+
- 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
68
|
- 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
69
|
- 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
70
|
`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 +177,13 @@ Verify at the correct layer:
|
|
|
175
177
|
- Default: use the cheapest trustworthy verification for the changed surface first, then escalate only if the changed surface justifies it.
|
|
176
178
|
- Route additions: boot the app and hit the real URL.
|
|
177
179
|
- 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.
|
|
180
|
+
- SSR changes: use the browser MCP to load the real page and inspect rendered HTML plus browser console.
|
|
179
181
|
- 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.
|
|
182
|
+
- 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.
|
|
183
|
+
- 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
184
|
- 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
|
|
185
|
+
- 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.
|
|
186
|
+
- 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
187
|
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
|
|
185
188
|
|
|
186
189
|
## Implementation Rules
|
|
@@ -281,7 +284,6 @@ Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
|
281
284
|
- `npx proteum diagnose <path> --port <port>`
|
|
282
285
|
- `npx proteum verify owner <query>`
|
|
283
286
|
- `npx proteum verify request <path>`
|
|
284
|
-
- `npx proteum verify browser <path>`
|
|
285
287
|
- `npx proteum perf ...`
|
|
286
288
|
- `npx proteum trace ...`
|
|
287
289
|
- `npx proteum command ...`
|
|
@@ -12,5 +12,5 @@ Do not put here: reusable Proteum architecture contracts, shared verification ru
|
|
|
12
12
|
- Run `npx proteum refresh`.
|
|
13
13
|
- Read and acknowledge the applicable `AGENTS.md` files.
|
|
14
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. If
|
|
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. If `proteum dev` reports blocked instruction paths, resolve them before continuing.
|
|
16
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.
|
|
@@ -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`.
|
|
@@ -14,10 +15,10 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
14
15
|
|
|
15
16
|
- 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
17
|
- 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
|
+
- 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. Every `npx proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section 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
|
|
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
|
-
- When
|
|
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,8 @@ 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
|
+
- If the user asks to implement a feature, first inspect the relevant existing surface and state any implementation problem, pain point, attention point, or question you see. If a concern is blocking, or it can materially change product behavior, API shape, architecture, data model, cost, privacy, security, or UX, ask before editing; otherwise state the assumption and continue implementing.
|
|
15
16
|
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>` before reading large parts of the codebase.
|
|
16
17
|
- 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
18
|
- 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 +47,14 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
46
47
|
- 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
48
|
- 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
49
|
- 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
|
|
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.
|
|
50
|
+
- 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>`.
|
|
51
|
+
- 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. Every `proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
51
52
|
|
|
52
53
|
### Before Finishing
|
|
53
54
|
|
|
54
55
|
- 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
56
|
- 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.
|
|
57
|
+
- 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
58
|
- 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
59
|
- 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
60
|
`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 +167,13 @@ Verify at the correct layer:
|
|
|
165
167
|
- Default: use the cheapest trustworthy verification for the changed surface first, then escalate only if the changed surface justifies it.
|
|
166
168
|
- Route additions: boot the app and hit the real URL.
|
|
167
169
|
- 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.
|
|
170
|
+
- SSR changes: use the browser MCP to load the real page and inspect rendered HTML plus browser console.
|
|
169
171
|
- 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.
|
|
172
|
+
- 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.
|
|
173
|
+
- 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
174
|
- 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
|
|
175
|
+
- 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.
|
|
176
|
+
- 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
177
|
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
|
|
175
178
|
|
|
176
179
|
## Implementation Rules
|
|
@@ -271,7 +274,6 @@ Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
|
271
274
|
- `npx proteum diagnose <path> --port <port>`
|
|
272
275
|
- `npx proteum verify owner <query>`
|
|
273
276
|
- `npx proteum verify request <path>`
|
|
274
|
-
- `npx proteum verify browser <path>`
|
|
275
277
|
- `npx proteum perf ...`
|
|
276
278
|
- `npx proteum trace ...`
|
|
277
279
|
- `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. 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
|
|
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.
|
|
@@ -13,39 +13,18 @@ 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 {
|
|
17
|
+
configureProjectAgentInstructions,
|
|
18
|
+
findLikelyRepoRoot,
|
|
19
|
+
isInsideDirectory,
|
|
20
|
+
resolveCanonicalPath,
|
|
21
|
+
type TConfigureProjectAgentInstructionsResult,
|
|
22
|
+
} from '../utils/agents';
|
|
17
23
|
|
|
18
24
|
/*----------------------------------
|
|
19
25
|
- HELPERS
|
|
20
26
|
----------------------------------*/
|
|
21
27
|
|
|
22
|
-
const findLikelyRepoRoot = (startPath: string) => {
|
|
23
|
-
let currentPath = path.resolve(startPath);
|
|
24
|
-
|
|
25
|
-
while (true) {
|
|
26
|
-
if (fs.existsSync(path.join(currentPath, '.git'))) return currentPath;
|
|
27
|
-
|
|
28
|
-
const parentPath = path.dirname(currentPath);
|
|
29
|
-
if (parentPath === currentPath) return undefined;
|
|
30
|
-
currentPath = parentPath;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const resolveCanonicalPath = (inputPath: string) => {
|
|
35
|
-
const resolvedPath = path.resolve(inputPath);
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
return fs.realpathSync(resolvedPath);
|
|
39
|
-
} catch {
|
|
40
|
-
return resolvedPath;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const isInsideDirectory = ({ child, parent }: { child: string; parent: string }) => {
|
|
45
|
-
const relativePath = path.relative(parent, child);
|
|
46
|
-
return relativePath !== '' && !relativePath.startsWith('..') && !path.isAbsolute(relativePath);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
28
|
const assertProteumAppRoot = (appRoot: string) => {
|
|
50
29
|
if (isLikelyProteumAppRoot(appRoot)) return;
|
|
51
30
|
|
|
@@ -92,10 +71,10 @@ const promptMonorepoRoot = async ({
|
|
|
92
71
|
const promptBlockedOverwritePaths = async (blockedPaths: string[]) => {
|
|
93
72
|
if (blockedPaths.length === 0) return [];
|
|
94
73
|
|
|
95
|
-
console.info(await renderWarning('Proteum found existing
|
|
74
|
+
console.info(await renderWarning('Proteum found existing paths that block managed instruction updates.'));
|
|
96
75
|
console.info(
|
|
97
76
|
[
|
|
98
|
-
'Choose whether to overwrite each path with a Proteum
|
|
77
|
+
'Choose whether to overwrite each path with a tracked Proteum instruction file:',
|
|
99
78
|
...blockedPaths.map((entry) => `- ${entry}`),
|
|
100
79
|
].join('\n'),
|
|
101
80
|
);
|
|
@@ -145,7 +124,7 @@ const renderConfigureResultSections = (result: TConfigureProjectAgentInstruction
|
|
|
145
124
|
if (result.blocked.length > 0)
|
|
146
125
|
sections.push(
|
|
147
126
|
[
|
|
148
|
-
'Skipped
|
|
127
|
+
'Skipped blocked paths:',
|
|
149
128
|
...result.blocked.map((entry) => `- ${entry}`),
|
|
150
129
|
].join('\n'),
|
|
151
130
|
);
|
|
@@ -183,7 +162,7 @@ export const runConfigureAgentsWizard = async ({
|
|
|
183
162
|
: undefined;
|
|
184
163
|
console.info(
|
|
185
164
|
[
|
|
186
|
-
await renderTitle('PROTEUM CONFIGURE AGENTS', 'Configure Proteum
|
|
165
|
+
await renderTitle('PROTEUM CONFIGURE AGENTS', 'Configure tracked Proteum instruction files.'),
|
|
187
166
|
renderRows([{ label: 'app', value: appRoot === process.cwd() ? '.' : appRoot }]),
|
|
188
167
|
].join('\n\n'),
|
|
189
168
|
);
|
|
@@ -221,8 +200,8 @@ export const runConfigureAgentsWizard = async ({
|
|
|
221
200
|
await renderStep(
|
|
222
201
|
'[1/1]',
|
|
223
202
|
isMonorepo
|
|
224
|
-
? `Writing monorepo-aware instruction
|
|
225
|
-
: 'Writing standalone instruction
|
|
203
|
+
? `Writing monorepo-aware instruction files using ${monorepoRoot}.`
|
|
204
|
+
: 'Writing standalone instruction files.',
|
|
226
205
|
),
|
|
227
206
|
);
|
|
228
207
|
|
|
@@ -234,7 +213,7 @@ export const runConfigureAgentsWizard = async ({
|
|
|
234
213
|
});
|
|
235
214
|
const sections = renderConfigureResultSections(result);
|
|
236
215
|
|
|
237
|
-
console.info(await renderSuccess('Proteum-managed instruction
|
|
216
|
+
console.info(await renderSuccess('Proteum-managed instruction files are configured.'));
|
|
238
217
|
|
|
239
218
|
if (sections.length > 0) console.info(`\n${sections.join('\n\n')}`);
|
|
240
219
|
};
|