proteum 2.3.0 → 2.4.2
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 +8 -3
- package/README.md +20 -15
- package/agents/project/AGENTS.md +16 -10
- package/agents/project/DOCUMENTATION.md +1326 -0
- package/agents/project/app-root/AGENTS.md +2 -2
- package/agents/project/diagnostics.md +10 -9
- package/agents/project/optimizations.md +1 -1
- package/agents/project/root/AGENTS.md +15 -8
- package/agents/project/server/services/AGENTS.md +1 -0
- package/agents/project/tests/AGENTS.md +1 -0
- package/cli/commands/db.ts +160 -0
- package/cli/commands/dev.ts +148 -25
- package/cli/commands/diagnose.ts +2 -0
- package/cli/commands/explain.ts +38 -9
- package/cli/commands/mcp.ts +126 -9
- package/cli/commands/orient.ts +44 -17
- package/cli/commands/runtime.ts +100 -17
- package/cli/mcp/router.ts +1028 -0
- package/cli/presentation/commands.ts +56 -25
- package/cli/presentation/help.ts +1 -1
- package/cli/runtime/commands.ts +163 -21
- package/cli/runtime/devSessions.ts +328 -2
- package/cli/runtime/mcpDaemon.ts +288 -0
- package/cli/runtime/ports.ts +151 -0
- package/cli/utils/agents.ts +94 -17
- package/cli/utils/appRoots.ts +232 -0
- package/common/dev/database.ts +226 -0
- package/common/dev/diagnostics.ts +1 -1
- package/common/dev/inspection.ts +8 -1
- package/common/dev/mcpPayloads.ts +456 -17
- package/common/dev/mcpServer.ts +51 -0
- package/docs/agent-routing.md +32 -21
- package/docs/dev-commands.md +1 -1
- package/docs/dev-sessions.md +3 -1
- package/docs/diagnostics.md +21 -20
- package/docs/mcp.md +114 -50
- package/docs/migrate-from-2.1.3.md +3 -5
- package/docs/request-tracing.md +3 -3
- package/package.json +10 -3
- package/server/app/devDiagnostics.ts +92 -0
- package/server/app/devMcp.ts +55 -0
- package/server/services/prisma/mariadb.ts +7 -3
- package/server/services/router/http/index.ts +25 -0
- package/server/services/router/request/ip.test.cjs +0 -1
- package/tests/agents-utils.test.cjs +58 -3
- package/tests/cli-mcp-command.test.cjs +327 -0
- package/tests/codex-mcp-usage.test.cjs +307 -0
- package/tests/dev-sessions.test.cjs +113 -0
- package/tests/dev-transpile-watch.test.cjs +0 -1
- package/tests/eslint-rules.test.cjs +0 -1
- package/tests/inspection.test.cjs +0 -1
- package/tests/mcp.test.cjs +769 -2
- package/tests/router-cache-config.test.cjs +0 -1
- package/vitest.config.mjs +9 -0
- package/cli/mcp/provider.ts +0 -365
- package/cli/mcp/stdio.ts +0 -16
package/AGENTS.md
CHANGED
|
@@ -19,6 +19,7 @@ After those optimization concerns, preserve explicit, typed, machine-readable co
|
|
|
19
19
|
- Keep `server/index.ts` as the canonical type root for services, router context, request context, and models.
|
|
20
20
|
- Keep generated code deterministic, auditable, and easy to map back to source.
|
|
21
21
|
- Prefer typed traces, perf rollups, and manifest-backed diagnostics over ad hoc logging.
|
|
22
|
+
- For framework production changes, add or update focused unit tests for the touched behavior whenever applicable. Preserve or increase meaningful unit coverage toward 100%; if a change cannot be unit-tested, document why in the completion note.
|
|
22
23
|
- For Prisma-backed apps, declare database structure changes in the app's `schema.prisma` only. Never create or edit migration files manually, and never run schema-mutating SQL such as `ALTER TABLE`, `CREATE TABLE`, or `DROP TABLE`.
|
|
23
24
|
- Follow `agents/project/optimizations.md` when choosing packages, helpers, runtimes, plugins, or build infrastructure.
|
|
24
25
|
- Delete obsolete compatibility layers, helper indirection, and unused packages when safe.
|
|
@@ -33,7 +34,7 @@ npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
|
|
|
33
34
|
```
|
|
34
35
|
- After initializing any new framework worktree, immediately boot the required reference app dev servers with the elevated-permissions workflow below. Keep those servers running across subsequent changes and validation until the user explicitly asks to stop them, or until a retry, port change, stale-session cleanup, or conflicting live session requires a controlled stop.
|
|
35
36
|
- 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.
|
|
36
|
-
- 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`,
|
|
37
|
+
- 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`, run `npx proteum runtime status` in the intended app root first, then choose the exact next action or a known-free explicit port before starting `npx proteum dev --session-file <path> --port <port>`. If the same app already responds on the configured port without live tracking, use or repair that runtime instead of starting another server. Do not inspect normal page bodies to identify port ownership; use runtime status, dev-only `/__proteum/*` endpoints, and current listeners only when the compact Proteum surface cannot answer. After the server is ready, print the live server URL as a clickable Markdown link such as `[http://localhost:3100](http://localhost:3100)`.
|
|
37
38
|
- 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.
|
|
38
39
|
- 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.
|
|
39
40
|
- Before retrying a boot on the same app, changing ports, handling a conflicting live session, or when the user explicitly asks to stop servers, stop the relevant framework-started dev session with `npx proteum dev stop --session-file <path>` or clean stale sessions with `npx proteum dev stop --all --stale`. Do not stop healthy framework-started dev sessions merely because the current task is finished.
|
|
@@ -56,9 +57,13 @@ npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
|
|
|
56
57
|
- `/Users/gaetan/Desktop/Projets/unique.domains/platform`: Monorepo including the following apps:
|
|
57
58
|
- `/Users/gaetan/Desktop/Projets/unique.domains/platform/apps/product`
|
|
58
59
|
- `/Users/gaetan/Desktop/Projets/unique.domains/platform/apps/website`
|
|
59
|
-
-
|
|
60
|
+
- `/Users/gaetan/Desktop/Projets/klair.work`: Monorepo including the following apps:
|
|
61
|
+
- `/Users/gaetan/Desktop/Projets/klair.work/apps/web`
|
|
62
|
+
- `/Users/gaetan/Desktop/Projets/klair.work/apps/api`
|
|
63
|
+
- `/Users/gaetan/Desktop/Projets/klair.work/apps/worker`
|
|
64
|
+
- Inspect how the relevant reference apps currently use the touched feature, runtime, API, compiler behavior, or generated output before proposing or implementing changes.
|
|
60
65
|
- 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.
|
|
61
|
-
- Proteum MCP contract: `proteum mcp` is the
|
|
66
|
+
- Proteum MCP contract: `proteum mcp` is the machine-scope router agents register once, and `proteum dev` exposes each app runtime at `/__proteum/mcp`. `proteum dev` ensures one managed machine MCP daemon is running; do not start a second managed daemon. Agents should start with MCP `workflow_start` using `cwd` or a known `projectId`; ambiguous routing or offline app candidates use `project_resolve { cwd }`, and follow-up live app tools require the returned `projectId`. Dev-hosted app tools are already rooted to their own runtime. Keep MCP tools/resources compact, typed, capped, paginated for full trace detail, and read-only unless a future task explicitly expands the mutation contract. The database diagnostic exception is still read-only: MCP `db_query` and CLI `proteum db query` allow one capped `SELECT`, `SHOW`, or `EXPLAIN` statement only and return rows plus elapsed milliseconds. MCP payloads are compact single-line `proteum-mcp-v1` JSON, not pretty-printed human output. Do not implement MCP tools as thin CLI process wrappers when the data is available through manifest readers, tracked sessions, or dev runtime registries.
|
|
62
67
|
- 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.
|
|
63
68
|
- 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.
|
|
64
69
|
- 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`.
|
package/README.md
CHANGED
|
@@ -378,7 +378,7 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
|
|
|
378
378
|
| `proteum diagnose` | Combine owner lookup, diagnostics, trace data, and server logs for one concrete route or request target |
|
|
379
379
|
| `proteum perf` | Aggregate request-trace performance into hot paths, one-request waterfalls, regressions, and memory drift views |
|
|
380
380
|
| `proteum trace` | Inspect live dev-only request traces from the running SSR server |
|
|
381
|
-
| `proteum mcp` | Start the
|
|
381
|
+
| `proteum mcp` | Start, inspect, or attach to the machine-scope MCP router that routes live app reads by `projectId` |
|
|
382
382
|
| `proteum command` | Run a dev-only internal command locally or against a running dev server |
|
|
383
383
|
| `proteum session` | Mint a dev-only auth session token and Playwright-ready cookie payload |
|
|
384
384
|
| `proteum e2e` | Run Playwright with Proteum-managed `E2E_*` values instead of shell-leading env assignments |
|
|
@@ -412,15 +412,17 @@ proteum connect --strict
|
|
|
412
412
|
proteum explain
|
|
413
413
|
proteum explain owner /api/Auth/CurrentUser
|
|
414
414
|
proteum explain --routes --controllers --commands
|
|
415
|
+
proteum explain --routes --controllers --commands --full
|
|
415
416
|
proteum explain --connected --controllers
|
|
416
|
-
proteum explain --all --
|
|
417
|
+
proteum explain --all --full
|
|
417
418
|
proteum diagnose /
|
|
418
419
|
proteum diagnose /dashboard --port 3101
|
|
419
420
|
proteum perf top --since today
|
|
420
421
|
proteum perf request /dashboard --port 3101
|
|
421
422
|
proteum perf compare --baseline yesterday --target today --group-by route
|
|
422
423
|
proteum perf memory --since 1h --group-by controller
|
|
423
|
-
proteum mcp
|
|
424
|
+
proteum mcp
|
|
425
|
+
proteum mcp status
|
|
424
426
|
proteum command proteum/diagnostics/ping
|
|
425
427
|
proteum command proteum/diagnostics/ping --port 3101
|
|
426
428
|
proteum session admin@example.com --role ADMIN --port 3101
|
|
@@ -442,11 +444,11 @@ proteum create controller Founder/projects --method list
|
|
|
442
444
|
proteum create service Conversion/Plans
|
|
443
445
|
```
|
|
444
446
|
|
|
445
|
-
`proteum configure agents`
|
|
447
|
+
`proteum configure agents` writes a compact managed `# Proteum Instructions` router plus the task-specific instruction files that router points to. Standalone mode writes root documents into the app root; monorepo mode writes shared root documents such as `AGENTS.md`, `DOCUMENTATION.md`, `CODING_STYLE.md`, `diagnostics.md`, and `optimizations.md` into the chosen monorepo root and keeps only app-local instruction files in the Proteum app root. It preserves content outside managed sections and asks before replacing directories or foreign symlinks. If you decline, that path is left untouched.
|
|
446
448
|
|
|
447
449
|
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.
|
|
448
450
|
|
|
449
|
-
`proteum connect`, `proteum explain`, `proteum doctor`,
|
|
451
|
+
`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. `proteum runtime status` also inspects the configured router/HMR ports and returns an exact Start Dev action, so agents do not need to `curl` page routes to identify port owners. `proteum dev` exposes the app-root MCP contract at `/__proteum/mcp` and ensures one managed machine MCP daemon is running; `proteum mcp` is the machine-scope router agents register once. Agents should start with MCP `workflow_start`, use offline candidates to choose the correct app root when no dev server is live, then route repeated reads by the returned live `projectId`. For the full diagnostics and tracing model, see [docs/diagnostics.md](docs/diagnostics.md), [docs/mcp.md](docs/mcp.md), and [docs/request-tracing.md](docs/request-tracing.md).
|
|
450
452
|
|
|
451
453
|
## Dev Commands
|
|
452
454
|
|
|
@@ -488,7 +490,7 @@ The CLI talks to the running app over the dev-only `__proteum/session/start` end
|
|
|
488
490
|
|
|
489
491
|
Proteum includes a dev-only in-memory request trace buffer for auth, routing, controller, context, SSR, API, Prisma SQL, and render debugging.
|
|
490
492
|
|
|
491
|
-
This is separate from `proteum explain` and `proteum doctor`: tracing is live request-time data, while explain/doctor are manifest-backed structure and diagnostics. `proteum perf` aggregates the same trace buffer into hot-path, waterfall, compare, and memory views. When you already know the failing path and want the fastest suspect list, start with `proteum diagnose`; when the issue is performance, start with `proteum perf`; then drop into raw trace output only if needed. When an agent needs repeated trace, perf, diagnose, status, or instruction-routing reads from the same running app, use
|
|
493
|
+
This is separate from `proteum explain` and `proteum doctor`: tracing is live request-time data, while explain/doctor are manifest-backed structure and diagnostics. `proteum perf` aggregates the same trace buffer into hot-path, waterfall, compare, and memory views. When you already know the failing path and want the fastest suspect list, start with `proteum diagnose`; when the issue is performance, start with `proteum perf`; then drop into raw trace output only if needed. When an agent needs repeated trace, perf, diagnose, status, owner, or instruction-routing reads from the same running app, use machine MCP `workflow_start`, then pass the returned `projectId` to follow-up app-bound MCP tools.
|
|
492
494
|
|
|
493
495
|
When diagnosing or testing against an app, first read the default port from `PORT` or `./.proteum/manifest.json` and check whether a server is already running there. If it is, inspect the existing traces before reproducing the issue so you can collect past errors and their context.
|
|
494
496
|
|
|
@@ -554,13 +556,14 @@ Proteum answers those questions with explicit artifacts:
|
|
|
554
556
|
- `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, app-chosen connected-project config values, `TRACE_*`, and `ENABLE_PROFILER` env vars for the environment surface
|
|
555
557
|
- `server/index.ts` for the explicit root service graph
|
|
556
558
|
- `.proteum/manifest.json` for machine-readable app structure
|
|
557
|
-
- `proteum explain
|
|
559
|
+
- `proteum explain` for compact framework introspection, and `proteum explain --manifest` when the full manifest is required
|
|
558
560
|
- `proteum doctor --json` for structured diagnostics
|
|
559
561
|
- `proteum doctor --contracts --json` for generated-artifact and manifest-owned file checks
|
|
560
562
|
- `proteum explain owner <query>` for fast ownership lookup over routes, controllers, files, and generated artifacts
|
|
561
563
|
- `proteum diagnose <path>` for a one-shot request diagnosis surface
|
|
562
564
|
- `proteum perf top|request|compare|memory` for request-trace performance rollups
|
|
563
|
-
- `proteum mcp`
|
|
565
|
+
- `proteum mcp` for one managed machine-scope MCP router that starts with `workflow_start` and routes repeated low-token agent reads by `projectId`
|
|
566
|
+
- `/__proteum/mcp` from a running `proteum dev` server as the app-root runtime endpoint behind that router
|
|
564
567
|
- the profiler `Explain`, `Doctor`, `Diagnose`, and `Perf` tabs for a human-readable view over the same diagnostics and trace-derived perf contracts
|
|
565
568
|
- `proteum command ...` plus the profiler `Commands` tab for dev-only internal execution
|
|
566
569
|
- `proteum session ...` for explicit authenticated dev browser or API bootstrapping without login UI automation
|
|
@@ -568,13 +571,15 @@ Proteum answers those questions with explicit artifacts:
|
|
|
568
571
|
|
|
569
572
|
If you are an LLM or automation agent, start here:
|
|
570
573
|
|
|
571
|
-
1.
|
|
572
|
-
2.
|
|
573
|
-
3.
|
|
574
|
-
4.
|
|
575
|
-
5. Use
|
|
576
|
-
6.
|
|
577
|
-
7. If the
|
|
574
|
+
1. Use `proteum mcp` as the one registered MCP server; `proteum dev` ensures the managed machine daemon is running.
|
|
575
|
+
2. Call MCP `workflow_start` with `cwd` or a known `projectId`; if it is ambiguous or returns offline app candidates, use `project_resolve { cwd }`, choose the intended app root, follow its port-inspected next action when needed, then retry `workflow_start`.
|
|
576
|
+
3. Use the returned live `projectId` with MCP `runtime_status`, `orient`, `instructions_resolve`, `route_candidates`, `explain_summary`, `diagnose`, `trace_show`, `perf_request`, and `logs_tail` before CLI equivalents for repeated read-only app state.
|
|
577
|
+
4. Treat returned instruction previews as the allowed scope for read-only discovery and diagnostics. Read full file contents only before edits or git writes, when `fullRead`/`fullReadPolicy` requires it, or when compact previews are insufficient.
|
|
578
|
+
5. Use compact CLI commands for fallback, `dev`, `build`, `check`, `verify`, migrations, E2E, and final reproducible terminal evidence.
|
|
579
|
+
6. Use `proteum diagnose`, `proteum perf`, and compact `proteum trace` for reproducible command evidence when MCP is unavailable or the terminal output itself is needed.
|
|
580
|
+
7. If machine MCP routing fails, run `proteum mcp status` and `proteum runtime status` from the intended app root; if no live session exists, use the exact MCP offline or runtime-status next action. If the same app already responds on the configured port without live tracking, use or repair that runtime instead of starting another server. If a live session exists but runtime/MCP is unreachable, stop the listed session file first, then start dev again and retry `workflow_start`. Do not run diagnose, trace, or perf reads while runtime health is unreachable, and do not `curl` normal page routes to identify port ownership.
|
|
581
|
+
8. Inspect `server/index.ts`, controllers, services, or pages only after the routing/diagnostic surfaces identify the relevant owner. Do not run broad owner searches after MCP already returned the route/page/controller owner.
|
|
582
|
+
9. 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.
|
|
578
583
|
|
|
579
584
|
For implementation rules in a real Proteum app, treat the routed local `AGENTS.md` files plus `proteum orient`, compact CLI diagnostics, and MCP repeated-read surfaces as the task contract. This README is the framework overview, not the project-local instruction layer.
|
|
580
585
|
|
package/agents/project/AGENTS.md
CHANGED
|
@@ -4,12 +4,15 @@ This is the canonical standalone-app contract for Proteum-based projects shipped
|
|
|
4
4
|
When splitting instructions across a monorepo, put the Proteum-wide rules in the monorepo-root `AGENTS.md` and keep only app-root-specific additions in each Proteum app root `AGENTS.md`.
|
|
5
5
|
Role: keep only project-wide app rules here when one root `AGENTS.md` must carry both the reusable Proteum contract and the app-root addendum.
|
|
6
6
|
Keep here: cross-cutting project workflow, architecture contracts, shared typing rules, and rules that apply across client, server, pages, and tests.
|
|
7
|
-
Do not put here: detailed diagnostics workflow, optimization checklists, coding-style details, or narrow area-specific instructions that belong in `diagnostics.md`, `optimizations.md`, `CODING_STYLE.md`, `client/AGENTS.md`, `client/pages/AGENTS.md`, `server/routes/AGENTS.md`, `server/services/AGENTS.md`, or `tests/AGENTS.md`.
|
|
7
|
+
Do not put here: documentation-driven coding workflow, detailed diagnostics workflow, optimization checklists, coding-style details, or narrow area-specific instructions that belong in `DOCUMENTATION.md`, `diagnostics.md`, `optimizations.md`, `CODING_STYLE.md`, `client/AGENTS.md`, `client/pages/AGENTS.md`, `server/routes/AGENTS.md`, `server/services/AGENTS.md`, or `tests/AGENTS.md`.
|
|
8
8
|
|
|
9
|
+
Documentation source of truth: root-level `DOCUMENTATION.md`.
|
|
9
10
|
Optimization source of truth: root-level `optimizations.md`.
|
|
10
11
|
Diagnostics source of truth: root-level `diagnostics.md`.
|
|
11
12
|
Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
12
13
|
|
|
14
|
+
Managed compact root routers must use trigger -> canonical instruction file references, not copied summaries of this contract. If a trigger points here, load this full file before acting and keep the source rule here.
|
|
15
|
+
|
|
13
16
|
## Fast Triggers
|
|
14
17
|
|
|
15
18
|
- If you are working in a newly created Proteum worktree, before following the rest of these instructions:
|
|
@@ -22,13 +25,14 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
22
25
|
- test, re-run analysis and give a comparison table of before and after
|
|
23
26
|
- re-print the complete list of suggested fixes, but strike the ones we already implemented or not necessary anymore
|
|
24
27
|
- 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.
|
|
25
|
-
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>`
|
|
26
|
-
- Treat Proteum CLI and MCP output as the workflow router.
|
|
27
|
-
- When a Proteum MCP client is available,
|
|
28
|
+
- If the task is ambiguous, generated, connected, or multi-repo, start with MCP `workflow_start` and then MCP `orient { projectId, query }` only if the bootstrap did not return a sufficient owner or next action; use `npx proteum orient <query>` only when MCP is unavailable or terminal evidence is required.
|
|
29
|
+
- Treat Proteum CLI and MCP output as the workflow router. Treat instruction previews returned by MCP `workflow_start` or `instructions_resolve { projectId }` as the allowed instruction scope for read-only discovery and diagnostics. Read full file contents only before edits or git writes, when returned `fullRead`/`fullReadPolicy` requires it, or when the compact preview is insufficient. Do not read broad instruction folders or every managed instruction file up front.
|
|
30
|
+
- When a Proteum MCP client is available, first call MCP `workflow_start` with `cwd` or a known `projectId`. If it is ambiguous or returns offline app candidates, call `project_resolve { cwd }`, select the intended app root, start exactly one dev server from that app root when needed, then retry `workflow_start`. Pass the returned live `projectId` to every follow-up app-bound MCP tool. `npx proteum dev` ensures one managed machine MCP daemon is running; do not start a second managed daemon. Prefer MCP `runtime_status`, `orient`, `instructions_resolve`, `explain_summary`, `route_candidates`, `doctor`, `diagnose`, `trace_show`, `perf_request`, `logs_tail`, and `db_query` for read-only runtime/status/orientation/owner/route/trace/perf/log/database reads. Do not run CLI equivalents after a successful MCP result for the same read. Do not run broad source searches for route/page/controller ownership after MCP returns the owner. Use CLI commands when you need reproducible terminal validation, dev/build/check workflows, fallback repair, or output to share with a human.
|
|
28
31
|
- MCP payloads are compact single-line `proteum-mcp-v1` JSON with capped and paginated detail. Do not expand MCP output for human readability.
|
|
32
|
+
- For every non-trivial coding task, load and follow root-level `DOCUMENTATION.md` before coding.
|
|
29
33
|
- 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`.
|
|
30
34
|
- 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.
|
|
31
|
-
- If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning,
|
|
35
|
+
- If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning, use root-level `DOCUMENTATION.md` to choose the smallest relevant `./docs/` pack before editing. If a dev server is already running, print the live dev server URL as a clickable Markdown link.
|
|
32
36
|
- If the task needs new app or artifact boilerplate, prefer `npx proteum init ...` and `npx proteum create ...` before creating files by hand. Use `--dry-run --json` when an agent needs a machine-readable plan before writing files.
|
|
33
37
|
- If you changed `schema.prisma`, do not start testing or validation yet. Ask the user to run the following command in the affected worktree directory, replacing the placeholders, and wait for the user to reply exactly `continue` before resuming validation or tests:
|
|
34
38
|
```
|
|
@@ -57,10 +61,11 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
57
61
|
### During Implementation
|
|
58
62
|
|
|
59
63
|
- After running `npx proteum create ...`, adapt the generated code to the real feature instead of leaving placeholder logic in place.
|
|
60
|
-
- 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
|
|
64
|
+
- 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 runtime status` first, then use its exact Start Dev next action so occupied router/HMR ports are avoided. Do not `curl` normal page routes to identify a port owner; use Proteum runtime status or dev-only `/__proteum/*` endpoints. After the server is ready, print the live server URL as a clickable Markdown link.
|
|
61
65
|
- 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.
|
|
66
|
+
- Do not start a second `npx proteum dev` server in the same worktree, and do not start a second managed MCP daemon. If machine MCP routing fails, run `npx proteum mcp status` and `npx proteum runtime status` from the intended app root; if no live session exists, use the exact MCP offline or runtime-status next action instead of assuming the manifest default port. If the same app already responds on the configured port without live tracking, use or repair that runtime instead of starting another server. If a live session exists but runtime/MCP is unreachable, stop the listed session file first, then start dev again. Do not run diagnose, trace, or perf reads while runtime health is unreachable. Then retry MCP `workflow_start` and use the returned `projectId`.
|
|
62
67
|
- 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.
|
|
63
|
-
- During `npx proteum dev`, the app exposes the read-only Proteum MCP runtime endpoint at `/__proteum/mcp`; use it for repeated agent reads instead of spawning equivalent diagnostics commands.
|
|
68
|
+
- During `npx proteum dev`, the app exposes the read-only Proteum MCP runtime endpoint at `/__proteum/mcp`; use it for repeated agent reads instead of spawning equivalent diagnostics commands. For route/page/controller ownership, prefer MCP `workflow_start`, `route_candidates { projectId, query }`, or `explain_summary { projectId, query }` over broad `npx proteum explain --routes --controllers --full` dumps.
|
|
64
69
|
- 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>`.
|
|
65
70
|
- 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.
|
|
66
71
|
|
|
@@ -183,7 +188,7 @@ Verify at the correct layer:
|
|
|
183
188
|
- SSR changes: use the browser MCP to load the real page and inspect rendered HTML plus browser console.
|
|
184
189
|
- Router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app.
|
|
185
190
|
- 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 plus the full project `npx proteum check`.
|
|
186
|
-
- Generated, connected, or ownership-ambiguous changes: start with `npx proteum orient <query>` and
|
|
191
|
+
- Generated, connected, or ownership-ambiguous changes: start with MCP `workflow_start`, then `orient { projectId, query }` and `explain_summary { projectId, query }` only when more detail is needed; use `npx proteum orient <query>` and `npx proteum verify owner <query>` when MCP is unavailable or terminal evidence is required.
|
|
187
192
|
- 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.
|
|
188
193
|
- 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.
|
|
189
194
|
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
|
|
@@ -226,6 +231,7 @@ Verify at the correct layer:
|
|
|
226
231
|
## Hard Stops
|
|
227
232
|
|
|
228
233
|
- Never run schema-mutating SQL such as `ALTER TABLE`, `CREATE TABLE`, `DROP TABLE`, or `CREATE INDEX` to change database structure.
|
|
234
|
+
- For read-only SQL diagnosis, use MCP `db_query` or `npx proteum db query "<sql>"`; only one capped `SELECT`, `SHOW`, or `EXPLAIN` statement is allowed.
|
|
229
235
|
- Do not run `prisma *` yourself. If a schema change requires migration, ask the user to run `npx prisma migrate dev --config ./prisma.config.ts --name <migration name>` and wait for `continue`.
|
|
230
236
|
- Do not run `git restore` or `git reset`.
|
|
231
237
|
- Do not run write-mode git commands by default. The built-in exception is an exact `commit` reply, which allows `git add` and `git commit` in every affected repository or worktree touched during the whole conversation. Any other write-mode git action requires an explicit user request.
|
|
@@ -281,10 +287,10 @@ Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
|
281
287
|
- `npx proteum orient <query>`
|
|
282
288
|
- `npx proteum runtime status`
|
|
283
289
|
- `npx proteum mcp`
|
|
284
|
-
- `npx proteum mcp --url http://localhost:<port>`
|
|
285
290
|
- `npx proteum explain`
|
|
286
291
|
- `npx proteum explain --manifest`
|
|
287
292
|
- `npx proteum explain --connected --controllers`
|
|
293
|
+
- `npx proteum explain --connected --controllers --full` only when raw connected/controller arrays are required
|
|
288
294
|
- `npx proteum explain owner <query>`
|
|
289
295
|
- `npx proteum doctor`
|
|
290
296
|
- `npx proteum doctor --contracts`
|
|
@@ -326,7 +332,7 @@ Agents working in generated Proteum projects must use this delivery workflow for
|
|
|
326
332
|
4. Proteum check: refresh and validate generated framework contracts after route, page, controller, service, command, or config changes.
|
|
327
333
|
5. Validate unit + E2E: run the relevant unit tests and real-world journey E2E checks before calling the work complete.
|
|
328
334
|
|
|
329
|
-
Unit test expectation: production
|
|
335
|
+
Unit test expectation: production changes must always add or update focused unit tests for the touched behavior when applicable. Target 100% meaningful unit coverage for changed production paths. Any excluded generated files, migrations, framework shims, unreachable defensive branches, or changes that cannot reasonably be unit-tested must be documented in the completion note.
|
|
330
336
|
|
|
331
337
|
E2E expectation: real-world journeys must follow the project-local instructions in `tests/e2e/REAL_WORLD_JOURNEY_TESTS.md`. These tests should model complete user workflows, role transitions, permissions, state changes, and cross-view consistency rather than isolated happy paths.
|
|
332
338
|
|