proteum 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +44 -98
- package/README.md +121 -7
- package/agents/framework/AGENTS.md +133 -886
- package/agents/project/AGENTS.md +70 -127
- package/agents/project/client/AGENTS.md +22 -93
- package/agents/project/client/pages/AGENTS.md +24 -26
- package/agents/project/server/routes/AGENTS.md +10 -8
- package/agents/project/server/services/AGENTS.md +22 -159
- package/agents/project/tests/AGENTS.md +11 -8
- package/cli/app/config.ts +7 -20
- package/cli/bin.js +8 -0
- package/cli/commands/command.ts +243 -0
- package/cli/commands/commandLocalRunner.js +198 -0
- package/cli/commands/deploy/web.ts +1 -2
- package/cli/commands/dev.ts +96 -1
- package/cli/commands/doctor.ts +8 -74
- package/cli/commands/explain.ts +8 -186
- package/cli/commands/trace.ts +228 -0
- package/cli/compiler/artifacts/commands.ts +217 -0
- package/cli/compiler/artifacts/manifest.ts +35 -21
- package/cli/compiler/artifacts/services.ts +300 -1
- package/cli/compiler/client/index.ts +43 -8
- package/cli/compiler/common/commands.ts +175 -0
- package/cli/compiler/common/index.ts +1 -1
- package/cli/compiler/common/proteumManifest.ts +15 -114
- package/cli/compiler/index.ts +25 -2
- package/cli/compiler/server/index.ts +31 -6
- package/cli/paths.ts +16 -1
- package/cli/presentation/commands.ts +59 -5
- package/cli/presentation/devSession.ts +5 -0
- package/cli/runtime/commands.ts +60 -1
- package/cli/tsconfig.json +4 -1
- package/cli/utils/check.ts +1 -1
- package/client/app/component.tsx +13 -9
- package/client/dev/profiler/index.tsx +1511 -0
- package/client/dev/profiler/noop.tsx +5 -0
- package/client/dev/profiler/runtime.noop.ts +116 -0
- package/client/dev/profiler/runtime.ts +840 -0
- package/client/services/router/components/router.tsx +30 -2
- package/client/services/router/index.tsx +27 -3
- package/client/services/router/request/api.ts +133 -17
- package/commands/proteum/diagnostics.ts +11 -0
- package/common/dev/commands.ts +50 -0
- package/common/dev/diagnostics.ts +298 -0
- package/common/dev/profiler.ts +91 -0
- package/common/dev/proteumManifest.ts +135 -0
- package/common/dev/requestTrace.ts +109 -0
- package/common/env/proteumEnv.ts +284 -0
- package/common/router/index.ts +4 -22
- package/docs/dev-commands.md +86 -0
- package/docs/request-tracing.md +122 -0
- package/package.json +1 -2
- package/server/app/commands.ts +35 -370
- package/server/app/commandsManager.ts +393 -0
- package/server/app/container/config.ts +11 -49
- package/server/app/container/console/index.ts +2 -3
- package/server/app/container/index.ts +5 -2
- package/server/app/container/trace/index.ts +364 -0
- package/server/app/devCommands.ts +192 -0
- package/server/app/devDiagnostics.ts +53 -0
- package/server/app/index.ts +27 -4
- package/server/services/cron/CronTask.ts +73 -5
- package/server/services/cron/index.ts +34 -11
- package/server/services/fetch/index.ts +3 -10
- package/server/services/prisma/index.ts +66 -4
- package/server/services/router/http/index.ts +151 -0
- package/server/services/router/index.ts +200 -12
- package/server/services/router/request/api.ts +30 -1
- package/server/services/router/response/index.ts +83 -10
- package/server/services/router/response/page/document.tsx +16 -0
- package/server/services/router/response/page/index.tsx +27 -1
- package/skills/clean-project-code/SKILL.md +7 -2
- package/test-results/.last-run.json +4 -0
- package/types/aliases.d.ts +6 -0
- package/types/global/utils.d.ts +7 -14
- package/Rte.zip +0 -0
- package/agents/project/agents.md.zip +0 -0
- package/doc/TODO.md +0 -71
- package/doc/front/router.md +0 -27
- package/doc/workspace/workspace.png +0 -0
- package/doc/workspace/workspace2.png +0 -0
- package/doc/workspace/workspace_26.01.22.png +0 -0
- package/server/services/router/http/session.ts.old +0 -40
package/AGENTS.md
CHANGED
|
@@ -1,113 +1,59 @@
|
|
|
1
|
-
# Proteum
|
|
1
|
+
# Proteum Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file governs work in the Proteum framework repository itself. For downstream app rules, use `agents/framework/AGENTS.md`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Priorities
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
When tradeoffs exist, prioritize framework decisions in this order:
|
|
7
|
+
When tradeoffs exist, optimize in this order:
|
|
10
8
|
|
|
11
9
|
1. Reduce shipped client bundle size and unnecessary runtime code.
|
|
12
|
-
2.
|
|
13
|
-
3. Improve SEO output and
|
|
10
|
+
2. Improve build-time, server-time, and browser-time performance.
|
|
11
|
+
3. Improve SEO output and crawlable, semantic HTML.
|
|
14
12
|
4. Preserve explicit, typed, machine-readable contracts for agents.
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
## Core Rules
|
|
17
15
|
|
|
18
|
-
- Prefer explicit
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- Prefer inference from the explicit application class in `server/index.ts` whenever possible. Treat `server/index.ts` as the canonical type root for application services, router services, router context, and models instead of duplicating manual type declarations.
|
|
26
|
-
- Prefer exact end-to-end contracts for inputs, outputs, errors, side effects, and caching behavior.
|
|
27
|
-
- Prefer framework features that make impact analysis, verification, and debugging easier for agents.
|
|
28
|
-
- Prefer output that is fast to render, easy to crawl, semantically rich, and easy for LLMs to parse reliably.
|
|
29
|
-
- Avoid introducing abstractions that require broad codebase memory to use correctly.
|
|
16
|
+
- Prefer explicit typed contracts over runtime magic or hidden conventions.
|
|
17
|
+
- Keep `server/index.ts` as the canonical type root for services, router context, request context, and models.
|
|
18
|
+
- Keep generated code deterministic, auditable, and easy to map back to source.
|
|
19
|
+
- Prefer typed traces and manifest-backed diagnostics over ad hoc logging.
|
|
20
|
+
- Check existing repo dependencies and npm before inventing a new helper, runtime, plugin, or abstraction.
|
|
21
|
+
- Prefer established, flexible, well-typed packages; build custom only when packages fail on bundle size, performance, SSR behavior, typing, flexibility, or maintenance risk.
|
|
22
|
+
- Delete obsolete compatibility layers, helper indirection, and unused packages when safe.
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
## Workflow
|
|
32
25
|
|
|
33
|
-
-
|
|
26
|
+
- If the user pastes raw errors without asking for a fix, do not implement changes. List likely causes and, for each one, give probability, why, and how to fix it.
|
|
27
|
+
- End your work with `Commit message`: one short top-level sentence, max 90 characters.
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
## Core Changes
|
|
36
30
|
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
31
|
+
- Validate framework changes against both reference apps:
|
|
32
|
+
- `/Users/gaetan/Desktop/Projets/crosspath/platform`
|
|
33
|
+
- `/Users/gaetan/Desktop/Projets/unique.domains/website`
|
|
34
|
+
- Inspect how both apps currently use the touched feature, runtime, API, compiler behavior, or generated output before proposing or implementing changes.
|
|
35
|
+
- Keep core changes aligned with the explicit controller/page architecture in `agents/framework/AGENTS.md`.
|
|
36
|
+
- Prefer removing framework magic when the same result can be expressed with explicit contracts, generated code, or typed context.
|
|
37
|
+
- Challenge any webpack plugin, Babel plugin, alias, helper, runtime service, or npm package that is not meaningfully used by both apps.
|
|
38
|
+
- Remove dead docs, flags, helper files, and compatibility branches in the same pass when safe.
|
|
43
39
|
|
|
44
|
-
##
|
|
40
|
+
## Proposals
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
- Start from the concrete mismatch or risk visible in the reference apps.
|
|
43
|
+
- Name the npm packages or package categories evaluated first when adding capability or infrastructure.
|
|
44
|
+
- Show the target API with real Proteum-style client and server usage.
|
|
45
|
+
- Separate the ideal end state from any migration rule.
|
|
46
|
+
- Name the source files that drive generated artifacts when generation changes.
|
|
47
|
+
- Explicitly name removed behavior and why it is obsolete.
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- Strong typings are mandatory across the whole project. Do not use `any` or `unknown`; keep types explicit, precise, and consistent.
|
|
60
|
-
- Prefer deriving types from the explicit application class in `server/index.ts` instead of recreating them manually in feature code, helpers, or generated output.
|
|
61
|
-
- Server route entrypoints live in `server/controllers/**/*.ts` files.
|
|
62
|
-
- Controllers extend `Controller` and read request-scoped values from `this.request`.
|
|
63
|
-
- Controllers validate request input via `this.input(schema)` inside the method body. Do not use decorators for validation metadata.
|
|
64
|
-
- `server/config/*.ts` should export plain typed config constants with `Services.config(ServiceClass, { ... })`, for example `export const missionsConfig = Services.config(Missions, { ... })`.
|
|
65
|
-
- `server/index.ts` should default-export the app `Application` subclass and instantiate root services as public fields via `new ServiceClass(this, config, this)`.
|
|
66
|
-
- Normal services extend `Service` and should use `this.services`, `this.models`, and `this.app` instead of implicit globals or magic imports.
|
|
67
|
-
- App services should be inferred from the explicit `server/index.ts` application graph and the config passed into each constructor, not hand-maintained parallel interfaces.
|
|
68
|
-
- Router services and router/request context values such as `user`, `auth`, and similar request-scoped contracts should come from inferred request and app types, not ad hoc casts.
|
|
69
|
-
- Models should be inferred from the app/model registry rooted at `server/index.ts` and exposed through generated app types, not from duplicated hand-written model maps.
|
|
70
|
-
- Controllers should own auth, input parsing, and request concerns, then pass explicit typed values into services.
|
|
71
|
-
- Do not reintroduce runtime server imports or globals such as `@request`, `@models`, or `@app`.
|
|
72
|
-
- Client pages use `Router.page(path, render)` or `Router.page(path, setup, render)`.
|
|
73
|
-
- SSR data loading belongs in the `setup` function returned object, not in `api.fetch(...)`.
|
|
74
|
-
- Client-side controller access should come from the generated controller tree and client context, not from fake runtime imports.
|
|
75
|
-
- When referencing an app service, a router service, or a model, expose it in the current block scope first by destructuring from `this.request`, `this.app`, or `this.app.Models.client`, then call methods on that local binding. The service, router value, or model should be the first element of the callee chain.
|
|
76
|
-
|
|
77
|
-
## Solution Proposals
|
|
78
|
-
|
|
79
|
-
When presenting a framework solution, make it easy to judge against the real apps.
|
|
80
|
-
|
|
81
|
-
- Start from the actual mismatch or risk seen in the apps, not from abstract framework theory.
|
|
82
|
-
- Show the target API with concrete client and server usage examples that match current Proteum conventions.
|
|
83
|
-
- Distinguish:
|
|
84
|
-
- the ideal end-state API
|
|
85
|
-
- any transitional migration rule or guardrail
|
|
86
|
-
- Call out what becomes impossible or safer after the change.
|
|
87
|
-
- If the change affects generated code, explain what source files drive generation and what artifacts are produced.
|
|
88
|
-
- If the change removes older behavior, explicitly name what is being deleted and why it is obsolete.
|
|
89
|
-
|
|
90
|
-
## Implementation Rules
|
|
91
|
-
|
|
92
|
-
- Keep framework changes aligned with the explicit controller/page architecture already adopted in the reference apps.
|
|
93
|
-
- Prefer deleting client-side code, dependencies, and emitted assets when the same capability can stay on the server or be generated statically.
|
|
94
|
-
- Prefer deleting obsolete branches, compatibility layers, plugins, and dependencies over keeping dead paths around.
|
|
95
|
-
- Prefer compiler logic that is deterministic, auditable, and easy for another agent to trace from source to generated output.
|
|
96
|
-
- Prefer local destructuring that exposes typed app services, router services, router context values, and models in the current block scope before use, instead of chaining through `this.request`, `this.app`, or `this.app.Models.client` at each call site.
|
|
97
|
-
- Reject changes that increase bundle size, runtime cost, or crawlability risk unless the benefit is concrete and validated in both reference apps.
|
|
98
|
-
- When removing old behavior, also remove the related packages, config flags, typings, docs, and dead helper files in the same pass when safe.
|
|
99
|
-
- If a core change breaks one of the reference apps, keep iterating until the framework and the affected app usage are both corrected.
|
|
100
|
-
|
|
101
|
-
## Real-World Validation
|
|
102
|
-
|
|
103
|
-
Do not stop at static analysis or isolated core compilation when the change affects runtime behavior.
|
|
104
|
-
|
|
105
|
-
- Validate framework changes against the two reference apps whenever the change touches routing, controllers, generated code, SSR, client runtime, services, webpack, Babel, or emitted assets.
|
|
106
|
-
- Preferred runtime validation:
|
|
107
|
-
- run `npx proteum dev --no-cache -port 3xxx` in both apps on explicit ports
|
|
108
|
-
- open the real pages with Playwright
|
|
109
|
-
- inspect browser console errors and warnings
|
|
110
|
-
- inspect server startup and runtime errors
|
|
111
|
-
- Build-only checks are not sufficient for runtime/compiler changes. Use them as supplements, not as the final proof.
|
|
112
|
-
- Keep fixing regressions exposed by the dev-server and browser pass until both apps boot and the browser console shows no new real errors.
|
|
113
|
-
- Treat external/local-environment warnings separately from framework regressions, and say clearly when something is unrelated to the current change.
|
|
49
|
+
## Runtime Validation
|
|
50
|
+
|
|
51
|
+
Do not stop at static analysis for routing, controllers, generated code, SSR, client runtime, services, webpack, Babel, or emitted assets.
|
|
52
|
+
|
|
53
|
+
- Run `npx proteum dev --no-cache --port 3xxx` in both reference apps on explicit ports.
|
|
54
|
+
- For request-time behavior, arm traces with `proteum trace arm --capture deep`, reproduce once, then inspect `proteum trace latest` or `proteum trace show <requestId>`.
|
|
55
|
+
- Open the real pages with Playwright.
|
|
56
|
+
- Inspect browser console errors and warnings.
|
|
57
|
+
- Inspect server startup and runtime errors.
|
|
58
|
+
|
|
59
|
+
Build-only checks are supplementary. Iterate until both apps boot and show no new framework regressions, and call unrelated environment warnings out separately.
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Proteum combines:
|
|
|
28
28
|
- **Explicit request entrypoints.** Controllers are classes. Request access is explicit through `this.request`.
|
|
29
29
|
- **Local validation.** Validate handler input inside the handler with `this.input(schema)`.
|
|
30
30
|
- **Deterministic generation.** Proteum owns `.proteum/` and regenerates it from source.
|
|
31
|
-
- **Explainability matters.** `proteum explain` and `proteum
|
|
31
|
+
- **Explainability matters.** `proteum explain`, `proteum doctor`, and `proteum trace` expose the framework view of your app and its live requests.
|
|
32
32
|
- **SEO is not an afterthought.** Identity, routes, layouts, and SSR data are part of the app contract.
|
|
33
33
|
|
|
34
34
|
## What a Proteum App Looks Like
|
|
@@ -36,8 +36,9 @@ Proteum combines:
|
|
|
36
36
|
```text
|
|
37
37
|
my-app/
|
|
38
38
|
identity.yaml
|
|
39
|
-
env
|
|
39
|
+
.env # optional file for required local env vars
|
|
40
40
|
package.json
|
|
41
|
+
commands/
|
|
41
42
|
client/
|
|
42
43
|
pages/
|
|
43
44
|
_layout/
|
|
@@ -63,14 +64,34 @@ my-app/
|
|
|
63
64
|
Important files:
|
|
64
65
|
|
|
65
66
|
- `identity.yaml`: app identity, naming, locale, and SEO-facing metadata defaults
|
|
66
|
-
- `env
|
|
67
|
+
- `process.env` / optional `.env`: `PORT`, `ENV_*`, `URL`, and `TRACE_*` environment variables loaded by the app
|
|
67
68
|
- `server/config/*.ts`: plain typed config exports consumed by the explicit app bootstrap
|
|
68
69
|
- `server/index.ts`: default-exported `Application` subclass that instantiates root services and router plugins
|
|
69
70
|
- `client/pages/**`: SSR page entrypoints registered through `Router.page(...)`
|
|
70
71
|
- `server/controllers/**`: request handlers that extend `Controller`
|
|
72
|
+
- `commands/**`: dev-only internal commands that extend `Commands`
|
|
71
73
|
- `server/services/**`: business logic that extends `Service`
|
|
72
74
|
- `.proteum/**`: framework-owned generated contracts and manifests
|
|
73
75
|
|
|
76
|
+
Required Proteum env vars:
|
|
77
|
+
|
|
78
|
+
- `ENV_NAME`: `local` or `server`
|
|
79
|
+
- `ENV_PROFILE`: `dev`, `testing`, or `prod`
|
|
80
|
+
- `PORT`: default router port
|
|
81
|
+
- `URL`: canonical absolute base URL for `Router.url(..., true)`
|
|
82
|
+
|
|
83
|
+
Proteum does not provide defaults for required env vars. They must be defined explicitly in `process.env` or `.env`.
|
|
84
|
+
|
|
85
|
+
Use `proteum explain env` to see the required env vars, their allowed values, and whether each one is currently provided.
|
|
86
|
+
|
|
87
|
+
Optional trace env vars:
|
|
88
|
+
|
|
89
|
+
- `TRACE_ENABLE`
|
|
90
|
+
- `TRACE_REQUESTS_LIMIT`
|
|
91
|
+
- `TRACE_EVENTS_LIMIT`
|
|
92
|
+
- `TRACE_CAPTURE`
|
|
93
|
+
- `TRACE_PERSIST_ON_ERROR`
|
|
94
|
+
|
|
74
95
|
## Example: Server Bootstrap
|
|
75
96
|
|
|
76
97
|
Proteum app services are declared explicitly through typed config exports plus a concrete `Application` subclass.
|
|
@@ -87,7 +108,7 @@ type RouterBaseConfig = Omit<ServiceConfig<typeof Router>, 'plugins'>;
|
|
|
87
108
|
export const usersConfig = Services.config(Users, {});
|
|
88
109
|
|
|
89
110
|
export const routerBaseConfig = {
|
|
90
|
-
|
|
111
|
+
currentDomain: AppContainer.Environment.router.currentDomain,
|
|
91
112
|
http: {
|
|
92
113
|
domain: 'example.com',
|
|
93
114
|
port: AppContainer.Environment.router.port,
|
|
@@ -181,6 +202,35 @@ Controller rules:
|
|
|
181
202
|
- call business logic through `this.services`, `this.models`, or `this.app`
|
|
182
203
|
- return explicit values instead of relying on ambient globals
|
|
183
204
|
|
|
205
|
+
## Example: Command
|
|
206
|
+
|
|
207
|
+
Proteum commands are explicit dev-only internal entrypoints.
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import { Commands } from '@server/app/commands';
|
|
211
|
+
|
|
212
|
+
export default class DiagnosticsCommands extends Commands {
|
|
213
|
+
public async ping() {
|
|
214
|
+
const { Stats } = this.services;
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
app: this.app.identity.identifier,
|
|
218
|
+
domains: await Stats.general(),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Command rules:
|
|
225
|
+
|
|
226
|
+
- files live under `commands/**/*.ts`
|
|
227
|
+
- each file default-exports a class extending `Commands` from `@server/app/commands`
|
|
228
|
+
- methods with bodies become generated dev commands
|
|
229
|
+
- command path comes from the file path plus the method name
|
|
230
|
+
- `export const commandPath = 'Custom/path'` can override the base path when needed
|
|
231
|
+
- `commands/tsconfig.json` and `.proteum/server/commands.d.ts` give `/commands` its own dev-only alias and app typing surface
|
|
232
|
+
- commands run only in dev contexts: `proteum command ...`, the dev profiler, or dev-only `__proteum/commands` endpoints
|
|
233
|
+
|
|
184
234
|
## Example: Service
|
|
185
235
|
|
|
186
236
|
Proteum services keep business logic out of request handlers.
|
|
@@ -215,6 +265,7 @@ Typical generated artifacts:
|
|
|
215
265
|
- `.proteum/client/controllers.ts`
|
|
216
266
|
- `.proteum/client/layouts.ts`
|
|
217
267
|
- `.proteum/common/controllers.ts`
|
|
268
|
+
- `.proteum/server/commands.ts`
|
|
218
269
|
- `.proteum/server/routes.ts`
|
|
219
270
|
- `.proteum/server/controllers.ts`
|
|
220
271
|
|
|
@@ -236,6 +287,8 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
|
|
|
236
287
|
| `proteum build --prod` | Produce the production server and client bundles into `bin/` |
|
|
237
288
|
| `proteum doctor` | Inspect manifest diagnostics |
|
|
238
289
|
| `proteum explain` | Explain routes, controllers, services, layouts, conventions, and env |
|
|
290
|
+
| `proteum trace` | Inspect live dev-only request traces from the running SSR server |
|
|
291
|
+
| `proteum command` | Run a dev-only internal command locally or against a running dev server |
|
|
239
292
|
| `proteum init` | Experimental project scaffolding when scaffold assets are installed |
|
|
240
293
|
|
|
241
294
|
Recommended daily workflow:
|
|
@@ -253,10 +306,68 @@ Useful inspection commands:
|
|
|
253
306
|
proteum doctor
|
|
254
307
|
proteum doctor --json
|
|
255
308
|
proteum explain
|
|
256
|
-
proteum explain --routes --controllers
|
|
309
|
+
proteum explain --routes --controllers --commands
|
|
257
310
|
proteum explain --all --json
|
|
311
|
+
proteum command proteum/diagnostics/ping
|
|
312
|
+
proteum command proteum/diagnostics/ping --port 3101
|
|
313
|
+
proteum trace requests
|
|
314
|
+
proteum trace arm --capture deep
|
|
315
|
+
proteum trace latest
|
|
258
316
|
```
|
|
259
317
|
|
|
318
|
+
## Dev Commands
|
|
319
|
+
|
|
320
|
+
Proteum includes a dev-only command surface for internal testing, debugging, and one-off execution that should not become a normal controller or route.
|
|
321
|
+
|
|
322
|
+
- commands live under `./commands/**/*.ts`
|
|
323
|
+
- each file default-exports a class extending `Commands` from `@server/app/commands`
|
|
324
|
+
- each method is addressed by `file/path/methodName`
|
|
325
|
+
- Proteum creates `commands/tsconfig.json` when the folder exists so command files inherit the server alias/type project
|
|
326
|
+
- `proteum command foo/bar` refreshes generated artifacts, builds the dev output, starts a temporary local dev server, runs the command, prints the result, and exits
|
|
327
|
+
- `proteum command foo/bar --port 3101` runs the same command against an existing `proteum dev` instance
|
|
328
|
+
- the dev profiler exposes the same command list and run action through the `Commands` tab
|
|
329
|
+
|
|
330
|
+
Proteum itself also ships a small built-in diagnostic command at `proteum/diagnostics/ping`, so the command surface is never empty in dev.
|
|
331
|
+
|
|
332
|
+
## Request Tracing
|
|
333
|
+
|
|
334
|
+
Proteum includes a dev-only in-memory request trace buffer for routing, controller, context, SSR, and render debugging.
|
|
335
|
+
|
|
336
|
+
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.
|
|
337
|
+
|
|
338
|
+
- `proteum trace requests`: list the most recent request summaries
|
|
339
|
+
- `proteum trace latest`: show the latest captured request
|
|
340
|
+
- `proteum trace show <requestId>`: inspect one trace in detail
|
|
341
|
+
- `proteum trace arm --capture deep`: force the next request into deep capture mode
|
|
342
|
+
- `proteum trace export <requestId>`: write one trace to disk
|
|
343
|
+
- `proteum trace latest --url http://127.0.0.1:3010`: target a non-standard dev base URL directly
|
|
344
|
+
|
|
345
|
+
Default behavior:
|
|
346
|
+
|
|
347
|
+
- tracing is enabled only in `profile: dev`
|
|
348
|
+
- traces live in memory and are bounded by `TRACE_REQUESTS_LIMIT` and `TRACE_EVENTS_LIMIT`
|
|
349
|
+
- payloads are summarized, long strings are truncated, and sensitive fields such as cookies, passwords, and tokens are redacted
|
|
350
|
+
- `TRACE_PERSIST_ON_ERROR` can export crashing requests under `var/traces/`
|
|
351
|
+
- `proteum dev` removes auto-persisted crash traces from `var/traces/` when the dev session stops
|
|
352
|
+
|
|
353
|
+
Trace env example:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
export TRACE_ENABLE=true
|
|
357
|
+
export TRACE_REQUESTS_LIMIT=200
|
|
358
|
+
export TRACE_EVENTS_LIMIT=800
|
|
359
|
+
export TRACE_CAPTURE=resolve
|
|
360
|
+
export TRACE_PERSIST_ON_ERROR=true
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Capture modes:
|
|
364
|
+
|
|
365
|
+
- `summary`: request lifecycle plus high-signal events
|
|
366
|
+
- `resolve`: adds route resolution and controller/context steps
|
|
367
|
+
- `deep`: adds route skip reasons and deeper payload summaries for one request investigation
|
|
368
|
+
|
|
369
|
+
The trace CLI talks to the running dev server over the dev-only `__proteum/trace` HTTP endpoints. Use `--port` for a different local port or `--url` when the host itself is non-standard. For the full guide, see [docs/request-tracing.md](docs/request-tracing.md).
|
|
370
|
+
|
|
260
371
|
## LLM-Friendly By Design
|
|
261
372
|
|
|
262
373
|
Proteum is built so an agent can answer these questions quickly and reliably:
|
|
@@ -271,22 +382,25 @@ Proteum is built so an agent can answer these questions quickly and reliably:
|
|
|
271
382
|
Proteum answers those questions with explicit artifacts:
|
|
272
383
|
|
|
273
384
|
- `identity.yaml` for app identity
|
|
274
|
-
- `
|
|
385
|
+
- `PORT`, `ENV_*`, `URL`, and `TRACE_*` env vars for the environment surface
|
|
275
386
|
- `server/index.ts` for the explicit root service graph
|
|
276
387
|
- `.proteum/manifest.json` for machine-readable app structure
|
|
277
388
|
- `proteum explain --json` for structured framework introspection
|
|
278
389
|
- `proteum doctor --json` for structured diagnostics
|
|
390
|
+
- `proteum command ...` plus the profiler `Commands` tab for dev-only internal execution
|
|
279
391
|
|
|
280
392
|
If you are an LLM or automation agent, start here:
|
|
281
393
|
|
|
282
394
|
1. Read `identity.yaml`.
|
|
283
|
-
2. Read `env
|
|
395
|
+
2. Read `PORT`, the relevant `ENV_*`, `URL`, and `TRACE_*` env vars, or run `proteum explain env`.
|
|
284
396
|
3. Inspect `server/index.ts` and `server/config/*.ts` for the explicit app bootstrap.
|
|
285
397
|
4. Read `.proteum/manifest.json` or run `proteum explain --json`.
|
|
286
398
|
5. Inspect `server/controllers/**` for request entrypoints.
|
|
287
399
|
6. Inspect `server/services/**` for business logic.
|
|
288
400
|
7. Inspect `client/pages/**` for SSR routes and page setup contracts.
|
|
289
401
|
|
|
402
|
+
For implementation rules in a real Proteum app, treat the local `AGENTS.md` files plus `proteum explain`, `proteum doctor`, and `proteum trace` as the task contract. This README is the framework overview, not the project-local instruction layer.
|
|
403
|
+
|
|
290
404
|
## What Proteum Avoids
|
|
291
405
|
|
|
292
406
|
Proteum intentionally avoids several patterns that make frameworks harder to inspect and harder to trust:
|