proteum 2.2.9 → 2.4.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 +10 -4
- package/README.md +58 -15
- package/agents/project/AGENTS.md +53 -10
- package/agents/project/DOCUMENTATION.md +1326 -0
- package/agents/project/app-root/AGENTS.md +2 -2
- package/agents/project/diagnostics.md +12 -7
- package/agents/project/optimizations.md +1 -0
- package/agents/project/root/AGENTS.md +24 -9
- package/agents/project/tests/AGENTS.md +7 -0
- package/agents/project/tests/e2e/AGENTS.md +13 -0
- package/agents/project/tests/e2e/REAL_WORLD_JOURNEY_TESTS.md +192 -0
- package/cli/commands/connect.ts +40 -4
- package/cli/commands/dev.ts +148 -25
- package/cli/commands/diagnose.ts +138 -5
- package/cli/commands/doctor.ts +24 -4
- package/cli/commands/explain.ts +134 -6
- package/cli/commands/mcp.ts +133 -0
- package/cli/commands/orient.ts +93 -3
- package/cli/commands/perf.ts +118 -13
- package/cli/commands/runtime.ts +234 -0
- package/cli/commands/trace.ts +116 -21
- package/cli/mcp/router.ts +1010 -0
- package/cli/presentation/commands.ts +93 -26
- package/cli/presentation/devSession.ts +2 -0
- package/cli/presentation/help.ts +1 -1
- package/cli/runtime/commands.ts +215 -24
- package/cli/runtime/devSessions.ts +328 -2
- package/cli/runtime/mcpDaemon.ts +288 -0
- package/cli/runtime/ports.ts +151 -0
- package/cli/utils/agentOutput.ts +46 -0
- package/cli/utils/agents.ts +194 -51
- package/cli/utils/appRoots.ts +232 -0
- package/common/dev/diagnostics.ts +1 -1
- package/common/dev/inspection.ts +22 -7
- package/common/dev/mcpPayloads.ts +1150 -0
- package/common/dev/mcpServer.ts +287 -0
- package/docs/agent-routing.md +137 -0
- package/docs/dev-commands.md +2 -0
- package/docs/dev-sessions.md +4 -1
- package/docs/diagnostics.md +70 -24
- package/docs/mcp.md +206 -0
- package/docs/migrate-from-2.1.3.md +14 -6
- package/docs/request-tracing.md +12 -6
- package/package.json +11 -3
- package/server/app/devMcp.ts +204 -0
- package/server/services/router/http/cache.ts +116 -0
- package/server/services/router/http/index.ts +94 -35
- package/server/services/router/index.ts +8 -11
- package/server/services/router/request/ip.test.cjs +0 -1
- package/tests/agents-utils.test.cjs +92 -14
- package/tests/cli-mcp-command.test.cjs +262 -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 +117 -9
- package/tests/eslint-rules.test.cjs +0 -1
- package/tests/inspection.test.cjs +66 -0
- package/tests/mcp.test.cjs +873 -0
- package/tests/router-cache-config.test.cjs +73 -0
- package/vitest.config.mjs +9 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This file is the app-root-only addendum for a Proteum app that lives inside a larger monorepo.
|
|
4
4
|
Keep the reusable Proteum contract in the nearest ancestor root `AGENTS.md`, and keep this file only for instructions that depend on the current directory being the Proteum app root.
|
|
5
5
|
Role: keep only app-root workflow and local project-semantic rules here.
|
|
6
|
-
Do not put here: reusable Proteum architecture contracts, shared verification rules, diagnostics workflow, optimization checklists, coding-style details, or area-specific rules already covered by broader `AGENTS.md` files or the root-level `diagnostics.md`, `optimizations.md`, and `CODING_STYLE.md`.
|
|
6
|
+
Do not put here: reusable Proteum architecture contracts, shared verification rules, documentation-driven coding workflow, diagnostics workflow, optimization checklists, coding-style details, or area-specific rules already covered by broader `AGENTS.md` files or the root-level `DOCUMENTATION.md`, `diagnostics.md`, `optimizations.md`, and `CODING_STYLE.md`.
|
|
7
7
|
|
|
8
8
|
## App-Root Triggers
|
|
9
9
|
|
|
@@ -13,4 +13,4 @@ Do not put here: reusable Proteum architecture contracts, shared verification ru
|
|
|
13
13
|
- Read and acknowledge the applicable `AGENTS.md` files.
|
|
14
14
|
- Run `npm i`.
|
|
15
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
|
-
- If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning,
|
|
16
|
+
- 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.
|
|
@@ -4,7 +4,10 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
4
4
|
|
|
5
5
|
## Initial Triage
|
|
6
6
|
|
|
7
|
-
- Start with machine-readable app state before reading large parts of the codebase
|
|
7
|
+
- Start with compact machine-readable app state before reading large parts of the codebase. When a Proteum MCP client is available, 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`. Use the returned live `projectId` for follow-up MCP `runtime_status`, `orient`, `instructions_resolve`, `explain_summary`, `route_candidates`, `doctor`, `diagnose`, `trace_latest`, `trace_show`, `perf_top`, `perf_request`, and `logs_tail`.
|
|
8
|
+
- 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 compact CLI commands such as `npx proteum orient <query>`, `npx proteum runtime status`, `npx proteum connect`, `npx proteum explain`, `npx proteum doctor`, and `npx proteum doctor --contracts` when MCP is unavailable, when generated artifacts or manifest-owned files may be stale, or when you need a reproducible shell command, validation step, or CI-like output.
|
|
9
|
+
- MCP payloads are compact `proteum-mcp-v1` JSON and are capped/paginated by default. Use selected instruction previews for read-only discovery and diagnostics; read full files or request full MCP detail only when returned `fullRead`/`fullReadPolicy` or omitted-detail hints require it.
|
|
10
|
+
- Use full-detail escape hatches only after compact output identifies the missing detail: `npx proteum explain --manifest`, `npx proteum diagnose <target> --full`, `npx proteum trace show <requestId> --events`, or `npx proteum perf request <requestId> --full`.
|
|
8
11
|
- 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.
|
|
9
12
|
- 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.
|
|
10
13
|
- Use `rg -n` first to narrow the exact code path, then read only the relevant files.
|
|
@@ -13,20 +16,22 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
13
16
|
|
|
14
17
|
## Runtime Diagnostics
|
|
15
18
|
|
|
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
|
|
19
|
+
- 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 runtime status` first, then use its exact next action so occupied router/HMR ports and untracked same-app runtimes are handled without page-body probes. After the server is ready, print the live server URL as a clickable Markdown link.
|
|
17
20
|
- 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.
|
|
18
21
|
- 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.
|
|
19
|
-
-
|
|
20
|
-
-
|
|
22
|
+
- During `npx proteum dev`, the running app exposes the read-only Proteum MCP transport at `/__proteum/mcp`. Use it for runtime-adjacent agent reads instead of repeatedly spawning equivalent CLI diagnostics.
|
|
23
|
+
- 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 so occupied router/HMR ports are avoided. 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 `curl` normal page routes to identify which app owns a port; use runtime status or Proteum dev-only endpoints. If a live session exists but runtime/MCP is unreachable, stop the listed session file first, then start dev again. Do not start a second dev server in the same worktree, and do not start a second managed MCP daemon. Do not run diagnose, trace, or perf reads while runtime health is unreachable. Then retry MCP `workflow_start` and use the returned `projectId`.
|
|
24
|
+
- For ownership or repo discovery questions, start with MCP `workflow_start`; use MCP `route_candidates { projectId, query }`, MCP `orient { projectId, query }`, and MCP `explain_summary { projectId, query }` only when the bootstrap owner summary is insufficient. Use `npx proteum orient <query>` or `npx proteum explain owner <query>` only when MCP is unavailable or terminal evidence is required.
|
|
25
|
+
- For request-time issues in dev, start with MCP `diagnose { projectId, path }` when you have a concrete failing route, page, controller path, or request target. Use `npx proteum diagnose <path> --port <port>` only when MCP is unavailable or terminal evidence is required. It combines owner lookup, manifest diagnostics, contract diagnostics, matching trace data, and buffered server logs in one pass.
|
|
21
26
|
- 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.
|
|
22
27
|
- 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.
|
|
23
28
|
- 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`.
|
|
24
|
-
- Use `
|
|
29
|
+
- Use MCP `workflow_start`, `route_candidates { projectId, query }`, or `explain_summary { projectId, query }` when you need a fast ownership graph for a route, controller path, source file, or generated artifact before reading code. Use `npx proteum explain owner <query>` only when MCP is unavailable or terminal evidence is required. Do not use `npx proteum explain --routes --full` unless compact owner/route tools explicitly cannot answer a raw route-array question.
|
|
25
30
|
- For performance issues or regressions in dev, use `npx proteum perf top --since <window>` to rank hot paths, `npx proteum perf request <requestId|path>` for one request waterfall plus chain attribution and SQL fingerprints, `npx proteum perf compare --baseline <window> --target <window>` for regressions, and `npx proteum perf memory --since <window>` for heap or RSS drift.
|
|
26
31
|
- For bundle-size inspection, use `npx proteum build --prod --analyze` to emit `bin/bundle-analysis/client.html` and `client-stats.json`, or add `--analyze-serve --analyze-port auto` when you want a local analyzer URL instead of a static HTML file.
|
|
27
32
|
- For request-time issues in dev, inspect traces before adding logs when the diagnose surface is still too coarse.
|
|
28
33
|
- If a server is already running on the default port from `PORT` or `./.proteum/manifest.json`, inspect existing traces before reproducing the issue.
|
|
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
|
|
34
|
+
- If existing traces are insufficient, arm `npx proteum trace arm --capture deep`, reproduce once, then inspect the new request with compact `npx proteum trace latest`; use `npx proteum trace show <requestId> --events` only when raw event detail is still required.
|
|
30
35
|
- Use the browser MCP to inspect browser console errors and warnings for frontend, SSR, hydration, and controller-call issues.
|
|
31
36
|
- Inspect server startup and runtime errors.
|
|
32
37
|
- 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.
|
|
@@ -53,7 +58,7 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
53
58
|
- After implementing a change, verify at the smallest trustworthy layer required by the changed surface first, then run the full project `npx proteum check` before finishing. Do not default to a running app, browser MCP, or Playwright while iterating when a narrower static or request-level verification is enough.
|
|
54
59
|
- 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.
|
|
55
60
|
- For request/runtime issues, verify through the real page, route, generated controller call, or command on a running app.
|
|
56
|
-
- Start the smallest trustworthy runtime surface first: `
|
|
61
|
+
- Start the smallest trustworthy runtime surface first: MCP `workflow_start`, then MCP `route_candidates { projectId, query }`, MCP `orient { projectId, query }`, or MCP `explain_summary { projectId, query }` only when more owner detail is needed. If runtime health is unreachable, repair/start dev before any diagnose, trace, or perf read. Once runtime is reachable, use the relevant real URL, generated controller call, command, or MCP `diagnose { projectId, path }`. Use CLI equivalents only when MCP is unavailable or terminal evidence is required. Use browser MCP validation only when request-level verification is insufficient or the change is browser-visible.
|
|
57
62
|
- 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.
|
|
58
63
|
- 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.
|
|
59
64
|
- 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.
|
|
@@ -19,6 +19,7 @@ When tradeoffs exist inside optimization work, optimize in this order:
|
|
|
19
19
|
- Prefer established, flexible, well-typed, widely adopted, actively maintained packages.
|
|
20
20
|
- Build custom or keep custom infrastructure only when packages would clearly hurt bundle size, SSR behavior, performance, typing quality, flexibility, licensing, explicit contracts, or long-term maintainability.
|
|
21
21
|
- If you choose custom over a package, state briefly why.
|
|
22
|
+
- For agent-facing repeated diagnostics, prefer the read-only Proteum MCP surface over adding broader CLI output. MCP should expose compact single-line `proteum-mcp-v1` JSON with capped, typed, paginated reads; the CLI should stay compact and reproducible.
|
|
22
23
|
|
|
23
24
|
## SSR And Page Size
|
|
24
25
|
|
|
@@ -3,17 +3,24 @@
|
|
|
3
3
|
This is the reusable Proteum-wide contract that is safe to place at the root of a monorepo above one or more Proteum apps.
|
|
4
4
|
Pair this file with an app-root `AGENTS.md` inside each Proteum app when local workflow or product-context instructions depend on the current directory being the app root.
|
|
5
5
|
Role: keep only reusable Proteum workflow, architecture contracts, shared typing rules, and cross-surface verification rules here.
|
|
6
|
-
Do not put here: app-root bootstrap steps,
|
|
6
|
+
Do not put here: app-root bootstrap steps, 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`.
|
|
7
7
|
|
|
8
|
+
Documentation source of truth: root-level `DOCUMENTATION.md`.
|
|
8
9
|
Optimization source of truth: root-level `optimizations.md`.
|
|
9
10
|
Diagnostics source of truth: root-level `diagnostics.md`.
|
|
10
11
|
Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
11
12
|
|
|
13
|
+
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.
|
|
14
|
+
|
|
12
15
|
## Fast Triggers
|
|
13
16
|
|
|
14
17
|
- 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
18
|
- 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.
|
|
16
|
-
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>`
|
|
19
|
+
- 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.
|
|
20
|
+
- 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.
|
|
21
|
+
- 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`, and `logs_tail` for read-only runtime/status/orientation/owner/route/trace/perf/log 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.
|
|
22
|
+
- MCP payloads are compact single-line `proteum-mcp-v1` JSON with capped and paginated detail. Do not expand MCP output for human readability.
|
|
23
|
+
- For every non-trivial coding task, load and follow root-level `DOCUMENTATION.md` before coding.
|
|
17
24
|
- 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`.
|
|
18
25
|
- 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.
|
|
19
26
|
- 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.
|
|
@@ -44,15 +51,18 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
44
51
|
### During Implementation
|
|
45
52
|
|
|
46
53
|
- After running `npx proteum create ...`, adapt the generated code to the real feature instead of leaving placeholder logic in place.
|
|
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
|
|
54
|
+
- 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.
|
|
48
55
|
- 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.
|
|
56
|
+
- 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`.
|
|
49
57
|
- 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.
|
|
58
|
+
- 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.
|
|
50
59
|
- For browser validation, use the browser MCP against the running app. Keep Playwright inside `npx proteum e2e --port <port>` for targeted/full end-to-end suites. Bootstrap protected browser MCP state with `npx proteum session`; bootstrap protected E2E runs with `npx proteum e2e --session-email <email> --session-role <role>`.
|
|
51
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. Every `proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
52
61
|
|
|
53
62
|
### Before Finishing
|
|
54
63
|
|
|
55
64
|
- Before finishing, re-check touched files against root-level `CODING_STYLE.md` and any narrower area `AGENTS.md` that applied to the edit. Re-check against root-level `optimizations.md` only for touched client-side files. Re-check against root-level `diagnostics.md` only if the task involved an issue, diagnosis, runtime reproduction, or verification failure.
|
|
65
|
+
- For production changes, always add or update focused unit tests for the touched behavior when applicable. Target 100% meaningful unit coverage for changed production paths, and document any generated files, migrations, framework shims, unreachable defensive branches, or changes that cannot reasonably be unit-tested.
|
|
56
66
|
- Run the full project `npx proteum check` before finishing each feature or change. Targeted lint, typecheck, diagnose, request, browser, or E2E runs are still useful while iterating, but they do not replace the final full check. 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
67
|
- Before finishing a task, stop every `proteum dev` session started during the task and confirm cleanup with `npx proteum dev list --json` or an explicit `npx proteum dev stop --session-file <path>`.
|
|
58
68
|
- When you have finished your work, ask the user whether they want a commit message. After providing a commit message or after creating a commit, immediately follow it with this exact prompt and obey it:
|
|
@@ -169,7 +179,7 @@ Verify at the correct layer:
|
|
|
169
179
|
- SSR changes: use the browser MCP to load the real page and inspect rendered HTML plus browser console.
|
|
170
180
|
- Router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app.
|
|
171
181
|
- New features or feature-behavior changes: use the cheapest trustworthy verification while iterating, use the browser MCP for browser-visible validation, then update the relevant end-to-end coverage and finish by running the full Playwright suite plus the full project `npx proteum check`.
|
|
172
|
-
- Generated, connected, or ownership-ambiguous changes: start with `npx proteum orient <query>` and
|
|
182
|
+
- 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.
|
|
173
183
|
- 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.
|
|
174
184
|
- 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.
|
|
175
185
|
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow root-level `diagnostics.md`.
|
|
@@ -262,19 +272,24 @@ Project code should consume:
|
|
|
262
272
|
|
|
263
273
|
Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
264
274
|
|
|
265
|
-
- `npx proteum connect
|
|
275
|
+
- `npx proteum connect`
|
|
266
276
|
- `npx proteum connect --controllers --strict`
|
|
267
277
|
- `npx proteum orient <query>`
|
|
268
|
-
- `npx proteum
|
|
278
|
+
- `npx proteum runtime status`
|
|
279
|
+
- `npx proteum mcp`
|
|
280
|
+
- `npx proteum explain`
|
|
281
|
+
- `npx proteum explain --manifest`
|
|
269
282
|
- `npx proteum explain --connected --controllers`
|
|
283
|
+
- `npx proteum explain --connected --controllers --full` only when raw connected/controller arrays are required
|
|
270
284
|
- `npx proteum explain owner <query>`
|
|
271
|
-
- `npx proteum doctor
|
|
272
|
-
- `npx proteum doctor --contracts
|
|
285
|
+
- `npx proteum doctor`
|
|
286
|
+
- `npx proteum doctor --contracts`
|
|
273
287
|
- `npx proteum diagnose <path> --port <port>`
|
|
274
288
|
- `npx proteum verify owner <query>`
|
|
275
289
|
- `npx proteum verify request <path>`
|
|
276
290
|
- `npx proteum perf ...`
|
|
277
|
-
- `npx proteum trace
|
|
291
|
+
- `npx proteum trace latest`
|
|
292
|
+
- `npx proteum trace show <requestId> --events`
|
|
278
293
|
- `npx proteum command ...`
|
|
279
294
|
- `npx proteum session ...`
|
|
280
295
|
- `npx proteum create ... --dry-run --json`
|
|
@@ -9,6 +9,7 @@ Diagnostics source of truth: root-level `diagnostics.md`.
|
|
|
9
9
|
|
|
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
|
+
- For every production change, add or update focused unit tests when applicable. Target 100% meaningful coverage for changed production paths, and document any generated files, migrations, framework shims, unreachable defensive branches, or changes that cannot reasonably be unit-tested.
|
|
12
13
|
- Verify routing, controllers, SSR, and router plugins against a running app when behavior depends on real request handling.
|
|
13
14
|
- 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
15
|
- Exercise real URLs, generated controller calls, or real browser flows instead of re-deriving framework internals in tests.
|
|
@@ -23,3 +24,9 @@ Diagnostics source of truth: root-level `diagnostics.md`.
|
|
|
23
24
|
- Keep end-to-end tests clean, well organized, and non-redundant. Prefer extending or reshaping the most relevant existing scenario over duplicating coverage, and remove or consolidate overlap when the suite becomes repetitive.
|
|
24
25
|
- Reuse root catalog files from `/client/catalogs/**`, `/server/catalogs/**`, or `/common/catalogs/**` instead of duplicating catalog constants in tests.
|
|
25
26
|
- For protected dev flows, prefer `npx proteum e2e --session-email <email> --session-role <role>` or `npx proteum session <email> --role <role>` over automating login unless the login flow itself is under test.
|
|
27
|
+
|
|
28
|
+
### Real-World Journey E2E
|
|
29
|
+
|
|
30
|
+
End-to-end tests must follow the workflow in `tests/e2e/REAL_WORLD_JOURNEY_TESTS.md`.
|
|
31
|
+
|
|
32
|
+
Use E2E journeys for complete role-based flows, permissions, state transitions, derived metrics, filters, detail/edit surfaces, and cross-role visibility. Avoid replacing those journeys with isolated happy-path smoke checks when the feature has real workflow depth.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# E2E Journey Test Instructions
|
|
2
|
+
|
|
3
|
+
Follow `REAL_WORLD_JOURNEY_TESTS.md` in this directory when designing, implementing, extending, or reviewing end-to-end tests.
|
|
4
|
+
|
|
5
|
+
Required structure for substantial E2E work:
|
|
6
|
+
|
|
7
|
+
- `tests/e2e/journeys/`: real-world journey specs grouped by workflow or domain.
|
|
8
|
+
- `tests/e2e/pages/`: page objects or screen helpers that keep selectors stable.
|
|
9
|
+
- `tests/e2e/workflows/`: reusable multi-step role and business workflows.
|
|
10
|
+
- `tests/e2e/factories/`: deterministic test data builders and fixtures.
|
|
11
|
+
- `tests/e2e/utils/`: login, navigation, assertions, network, and cleanup helpers.
|
|
12
|
+
|
|
13
|
+
Do not reduce E2E coverage to one-screen smoke tests when the feature involves multiple roles, permissions, workflow states, derived KPIs, or cross-view consistency.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Write Real World Journey Tests
|
|
2
|
+
|
|
3
|
+
Source: `/Users/gaetan/.codex/skills/write-real-world-journey-tests/SKILL.md`
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Create journey tests that read like an executable product spec. Prefer a realistic sequence of actions by real roles over a collection of disconnected UI checks.
|
|
8
|
+
|
|
9
|
+
The journey should cover the requested feature area broadly, but every step must be justified by normal user behavior and by state created earlier in the journey.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
1. Inspect the feature surface before designing the test.
|
|
14
|
+
- Read existing journey tests, page objects, factories, workflows, fixtures, selectors, and test utilities.
|
|
15
|
+
- Identify local conventions for auth, data creation, navigation, assertions, cleanup, retries, and timeouts.
|
|
16
|
+
- Reuse existing helpers before adding new ones.
|
|
17
|
+
- Preserve the repository's test-file organization instead of putting every helper inside the journey spec.
|
|
18
|
+
|
|
19
|
+
2. Follow the local E2E file organization.
|
|
20
|
+
- Put complete user journeys in `tests/e2e/journeys/*.spec.ts` or the repository's equivalent journey/spec directory.
|
|
21
|
+
- Put reusable screen abstractions in `tests/e2e/pages/**`, grouped by product area; use focused page objects for pages, modals, filter bars, pickers, and detail panels.
|
|
22
|
+
- Put reusable multi-step business flows in `tests/e2e/workflows/**`, such as login, signup via invite, create entity with invite link, or other flows shared by several journeys.
|
|
23
|
+
- Put generated domain data in `tests/e2e/factories/**`, with separate minimum, maximum, and edited payload factories when the journey needs create/edit coverage.
|
|
24
|
+
- Put shared technical/domain helpers in `tests/e2e/utils/**`, such as context creation, constants, API response parsing, date formatting, KPI expectations, number/currency parsers, display-name builders, and journey tree logging.
|
|
25
|
+
- Add a helper to the nearest existing page/workflow/factory/utils module when it is reusable; keep it local to the spec only when it is specific to that one journey's memory or assertions.
|
|
26
|
+
|
|
27
|
+
3. Map the real-world story.
|
|
28
|
+
- List the roles involved, their permissions, and why each role appears in the scenario.
|
|
29
|
+
- Identify the entities that move through the journey: account, team, organization, customer, order, lead, report, subscription, etc.
|
|
30
|
+
- Define the natural order: setup, invite/signup/login, empty state, creation, assignment, action by another role, management, reporting, audit/review.
|
|
31
|
+
- Prefer one coherent story over feature stuffing. Cover many features only when they belong to the same user journey.
|
|
32
|
+
|
|
33
|
+
4. Make the report-visible hierarchy explicit.
|
|
34
|
+
- Group journeys with `describe` blocks or the framework equivalent by business phase, such as acquisition, activation, setup, core workflow, limits, billing, and admin review.
|
|
35
|
+
- Split each journey test into named substeps with `test.step(...)`, Cypress command logs, or the local framework equivalent so CI reports and traces show what business phase failed.
|
|
36
|
+
- Name steps from the user or business perspective, such as `Launch plan blocks the third filter`, not from implementation details, such as `Click button`.
|
|
37
|
+
- Use nested substeps for repeated matrices like roles, plans, permissions, limits, or locales, with one visible step per case and smaller substeps for settings, allowed actions, and blocked actions.
|
|
38
|
+
- Preserve local file organization and helper conventions; hierarchy should improve readability without moving unrelated code or hiding assertions.
|
|
39
|
+
|
|
40
|
+
5. Use serial state only for real dependency chains.
|
|
41
|
+
- Use a serial describe block when later tests intentionally depend on state created by earlier actors.
|
|
42
|
+
- Split the journey into tests by actor/session or meaningful product phase.
|
|
43
|
+
- Use fresh browser contexts or sessions for different roles.
|
|
44
|
+
- Keep setup assertions at the top of each dependent test so failures explain the missing prerequisite.
|
|
45
|
+
|
|
46
|
+
6. Keep journey memory as the source of truth.
|
|
47
|
+
- Store created IDs, invite links, generated users, current payloads, assignment state, statuses, dates, and monetary values in typed in-memory objects.
|
|
48
|
+
- Update memory immediately after successful UI/API responses.
|
|
49
|
+
- Compute expectations from memory instead of duplicating constants in assertions.
|
|
50
|
+
- Track both `createdPayload` and `currentPayload` when edits are part of the journey.
|
|
51
|
+
|
|
52
|
+
7. Assert the product contract at each phase.
|
|
53
|
+
- Empty states and initial KPIs for new users.
|
|
54
|
+
- Role-specific navigation, tabs, menu labels, and restricted access.
|
|
55
|
+
- Created rows/cards/details match generated input.
|
|
56
|
+
- Default ownership, assignment, channel/source, payment terms, status, or permission behavior.
|
|
57
|
+
- Cross-role visibility after another role acts.
|
|
58
|
+
- Details modals, edit flows, notes/activity timelines, status changes, derived fields, filters, date ranges, and aggregate KPIs.
|
|
59
|
+
- Final manager/admin review across the whole organization or feature scope.
|
|
60
|
+
|
|
61
|
+
8. Make derived assertions resilient.
|
|
62
|
+
- Use polling for eventually consistent UI totals, KPI cards, async table updates, revenue/pipeline calculations, closing rates, and status text.
|
|
63
|
+
- Parse formatted numbers, currency, and percentages with shared utilities.
|
|
64
|
+
- Use deterministic date helpers for UI date formatting and date-range assertions.
|
|
65
|
+
- Wait for important create/update responses when IDs or persistence are needed.
|
|
66
|
+
|
|
67
|
+
9. Prefer expressive helpers.
|
|
68
|
+
- Introduce small helpers for repeated domain assertions, such as row basics, row KPI checks, snapshot comparison, filter setup, and derived totals.
|
|
69
|
+
- Keep helper names product-facing, not implementation-facing.
|
|
70
|
+
- Use page objects and workflow helpers to keep the test readable at the story level.
|
|
71
|
+
|
|
72
|
+
10. Log or snapshot the journey shape when useful.
|
|
73
|
+
- For long multi-role journeys, optionally keep a small tree or timeline logger showing created roles and entities.
|
|
74
|
+
- Use it for debugging and readability, not as a substitute for assertions.
|
|
75
|
+
|
|
76
|
+
## Implementation Pattern
|
|
77
|
+
|
|
78
|
+
Use this shape as a guide, adapting to the repository's test framework:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
test.describe.serial('Domain - Feature journey', () => {
|
|
82
|
+
test.describe.configure({ timeout: 300_000 });
|
|
83
|
+
|
|
84
|
+
let organization = createEmptyOrganizationMemory();
|
|
85
|
+
let manager = createEmptyAccountMemory();
|
|
86
|
+
let operator = createEmptyAccountMemory();
|
|
87
|
+
let externalPartner = createEmptyPartnerMemory();
|
|
88
|
+
let itemA = createItemMemory(createMinimumPayload(), { type: 'operator' });
|
|
89
|
+
let itemB = createItemMemory(createMaximumPayload(), { type: 'external-partner' });
|
|
90
|
+
|
|
91
|
+
const getCreatedItems = () => [itemA, itemB].filter((item) => item.id);
|
|
92
|
+
const buildKpis = () => ({
|
|
93
|
+
'Total Items': getCreatedItems().length,
|
|
94
|
+
'Completed': getCreatedItems().filter((item) => item.status === 'Completed').length,
|
|
95
|
+
});
|
|
96
|
+
const matrixCases = [{ name: 'Manager' }, { name: 'Operator' }];
|
|
97
|
+
|
|
98
|
+
test.describe('Setup and activation', () => {
|
|
99
|
+
test('Admin or owner creates the parent scope', async ({ browser }) => {
|
|
100
|
+
await test.step('Create the organization through the normal product path', async () => {
|
|
101
|
+
// Store IDs, invite links, and display data in memory.
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('Manager signs up and prepares the working structure', async ({ browser }) => {
|
|
106
|
+
await test.step('Assert restricted navigation and empty state', async () => {});
|
|
107
|
+
await test.step('Create the team and invite the next role', async () => {});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test.describe('Core workflow', () => {
|
|
112
|
+
test('Primary role performs the core workflow and delegates work', async ({ browser }) => {
|
|
113
|
+
await test.step('Create a minimum item', async () => {});
|
|
114
|
+
await test.step('Assert default ownership and visible table state', async () => {});
|
|
115
|
+
await test.step('Delegate the item to another role', async () => {});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('Secondary role acts on assigned state', async ({ browser }) => {
|
|
119
|
+
await test.step('Assert this role only sees assigned work', async () => {});
|
|
120
|
+
await test.step('Create or update a maximum-data item', async () => {});
|
|
121
|
+
await test.step('Assert role-specific defaults and KPIs', async () => {});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('Primary role manages resulting activity', async ({ browser }) => {
|
|
125
|
+
await test.step('Open details and validate data from the secondary role', async () => {});
|
|
126
|
+
await test.step('Add notes, edit fields, and change status', async () => {});
|
|
127
|
+
await test.step('Assert recalculated derived values', async () => {});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test.describe('Review and reporting', () => {
|
|
132
|
+
test('Manager or auditor reviews aggregate state', async ({ browser }) => {
|
|
133
|
+
await test.step('Assert cross-role visibility and filters', async () => {});
|
|
134
|
+
await test.step('Assert aggregate KPIs and final business outcomes', async () => {});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('Plan, role, or permission matrix exposes the correct behavior', async ({ browser }) => {
|
|
138
|
+
for (const caseItem of matrixCases) {
|
|
139
|
+
await test.step(`${caseItem.name} shows the right settings and limits`, async () => {
|
|
140
|
+
await test.step(`${caseItem.name} settings match contract`, async () => {});
|
|
141
|
+
await test.step(`${caseItem.name} allowed actions succeed`, async () => {});
|
|
142
|
+
await test.step(`${caseItem.name} blocked actions fail with the expected reason`, async () => {});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Coverage Heuristics
|
|
151
|
+
|
|
152
|
+
Include a feature when it naturally belongs to the journey and creates a durable assertion later. Strong candidates:
|
|
153
|
+
|
|
154
|
+
- Invite/signup/login boundaries.
|
|
155
|
+
- Permission differences between roles.
|
|
156
|
+
- Empty state to populated state.
|
|
157
|
+
- Minimum-data and maximum-data creation paths.
|
|
158
|
+
- Assignment, reassignment, ownership, membership, or sharing.
|
|
159
|
+
- Details view, edit view, notes, activity history, and status changes.
|
|
160
|
+
- Derived totals, dashboards, reporting cards, and tables.
|
|
161
|
+
- Filters, search, date ranges, sorting, and snapshots.
|
|
162
|
+
- Cross-role consistency: what one actor creates, another actor sees or manages.
|
|
163
|
+
|
|
164
|
+
Exclude or move to narrower tests:
|
|
165
|
+
|
|
166
|
+
- Pure component styling.
|
|
167
|
+
- Exhaustive validation errors.
|
|
168
|
+
- Every filter permutation.
|
|
169
|
+
- Rare edge cases that interrupt the main story.
|
|
170
|
+
- Admin-only setup that is unrelated to the requested feature.
|
|
171
|
+
|
|
172
|
+
## Quality Bar
|
|
173
|
+
|
|
174
|
+
- The scenario should be explainable as a real customer workflow.
|
|
175
|
+
- Each role should do work that role would actually do.
|
|
176
|
+
- Assertions should prove business behavior, not only that buttons are clickable.
|
|
177
|
+
- Later assertions should depend on earlier created state.
|
|
178
|
+
- Names, IDs, and dates should be generated uniquely enough for shared test environments.
|
|
179
|
+
- The test should fail near the broken product behavior, with step names that explain the business phase.
|
|
180
|
+
- The test report should expose a clear hierarchy of phases, tests, and substeps so a reader can understand the journey without opening the source file.
|
|
181
|
+
- Comments should clarify product intent or non-obvious timing behavior, not narrate obvious code.
|
|
182
|
+
|
|
183
|
+
## Anti-Patterns
|
|
184
|
+
|
|
185
|
+
- One huge test with no actor boundaries.
|
|
186
|
+
- Flat journey tests with no report-visible phases or substeps.
|
|
187
|
+
- Serial dependency without explicit prerequisite assertions.
|
|
188
|
+
- Hardcoded duplicate KPI values that drift after edits.
|
|
189
|
+
- Creating data directly in the database when the product flow under test is creation, signup, invite, assignment, or editing.
|
|
190
|
+
- Covering unrelated features just to increase line count.
|
|
191
|
+
- Hiding flakiness with arbitrary sleeps instead of waiting on UI state, network responses, or polling derived values.
|
|
192
|
+
- Testing only the creator role when the feature's value appears through another role's visibility or management flow.
|
package/cli/commands/connect.ts
CHANGED
|
@@ -2,8 +2,9 @@ import cli from '..';
|
|
|
2
2
|
import Compiler from '../compiler';
|
|
3
3
|
import { readProteumManifest } from '../compiler/common/proteumManifest';
|
|
4
4
|
import { buildConnectResponse, renderConnectHuman } from '@common/dev/connect';
|
|
5
|
+
import { compactList, printAgentResponse, printJson, truncateForAgent } from '../utils/agentOutput';
|
|
5
6
|
|
|
6
|
-
const allowedConnectArgs = new Set(['controllers', 'json', 'strict']);
|
|
7
|
+
const allowedConnectArgs = new Set(['controllers', 'full', 'human', 'json', 'strict']);
|
|
7
8
|
|
|
8
9
|
const validateConnectArgs = () => {
|
|
9
10
|
const enabledArgs = Object.entries(cli.args)
|
|
@@ -19,6 +20,29 @@ const validateConnectArgs = () => {
|
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
const compactDiagnostic = (diagnostic: ReturnType<typeof buildConnectResponse>['diagnostics'][number]) => ({
|
|
24
|
+
level: diagnostic.level,
|
|
25
|
+
code: diagnostic.code,
|
|
26
|
+
message: truncateForAgent(diagnostic.message),
|
|
27
|
+
filepath: diagnostic.filepath,
|
|
28
|
+
sourceLocation: diagnostic.sourceLocation,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const compactProject = (project: ReturnType<typeof buildConnectResponse>['projects'][number]) => ({
|
|
32
|
+
namespace: project.namespace,
|
|
33
|
+
identityIdentifier: project.identityIdentifier,
|
|
34
|
+
identityName: project.identityName,
|
|
35
|
+
sourceKind: project.sourceKind,
|
|
36
|
+
sourceConfigured: project.sourceConfigured,
|
|
37
|
+
urlInternalConfigured: project.urlInternalConfigured,
|
|
38
|
+
urlInternal: project.urlInternal,
|
|
39
|
+
controllerCount: project.controllerCount,
|
|
40
|
+
cachedContractExists: project.cachedContractExists,
|
|
41
|
+
cachedContractFilepath: project.cachedContractFilepath,
|
|
42
|
+
typingMode: project.typingMode,
|
|
43
|
+
controllers: project.controllers ? compactList(project.controllers, 8) : undefined,
|
|
44
|
+
});
|
|
45
|
+
|
|
22
46
|
export const run = async (): Promise<void> => {
|
|
23
47
|
validateConnectArgs();
|
|
24
48
|
|
|
@@ -31,10 +55,22 @@ export const run = async (): Promise<void> => {
|
|
|
31
55
|
strict: cli.args.strict === true,
|
|
32
56
|
});
|
|
33
57
|
|
|
34
|
-
if (cli.args.
|
|
35
|
-
|
|
36
|
-
} else {
|
|
58
|
+
if (cli.args.full === true) {
|
|
59
|
+
printJson(response);
|
|
60
|
+
} else if (cli.args.human === true) {
|
|
37
61
|
console.log(renderConnectHuman(manifest, response));
|
|
62
|
+
} else {
|
|
63
|
+
printAgentResponse({
|
|
64
|
+
summary: `Connect: ${response.summary.connectedProjects} projects, ${response.summary.importedControllers} controllers, ${response.summary.errors} errors, ${response.summary.warnings} warnings`,
|
|
65
|
+
data: {
|
|
66
|
+
app: response.app,
|
|
67
|
+
summary: response.summary,
|
|
68
|
+
projects: response.projects.map(compactProject),
|
|
69
|
+
diagnostics: compactList(response.diagnostics, 10).map(compactDiagnostic),
|
|
70
|
+
totalDiagnostics: response.diagnostics.length,
|
|
71
|
+
},
|
|
72
|
+
fullDetailCommand: `proteum connect${cli.args.controllers === true ? ' --controllers' : ''} --full`,
|
|
73
|
+
});
|
|
38
74
|
}
|
|
39
75
|
|
|
40
76
|
if (cli.args.strict === true && response.diagnostics.length > 0) {
|