@terreno/mcp 58.0.1 → 58.0.3
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/CHANGELOG.md +31 -0
- package/README.md +6 -4
- package/dist/docs/templates/bootstrap/frontend/app/_layout.template.tsx +2 -0
- package/dist/docs/upgrades/58.0.3.md +28 -0
- package/dist/docs/versioned/next/explanation/ai-development-loop.md +10 -7
- package/dist/docs/versioned/next/explanation/dependency-management.md +2 -9
- package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +13 -0
- package/dist/docs/versioned/next/explanation/test-isolation.md +2 -1
- package/dist/docs/versioned/next/explanation/test-sharding.md +111 -0
- package/dist/docs/versioned/next/how-to/README.md +1 -0
- package/dist/docs/versioned/next/how-to/circleci.md +12 -4
- package/dist/docs/versioned/next/how-to/debug-with-mcp.md +10 -1
- package/dist/docs/versioned/next/how-to/fix-code-scanning-alerts.md +43 -0
- package/dist/docs/versioned/next/how-to/run-tests-locally.md +5 -0
- package/dist/docs/versioned/next/how-to/set-up-terreno-mcp.md +3 -1
- package/dist/docs/versioned/next/how-to/update-dependencies.md +1 -1
- package/dist/docs/versioned/next/implementationPlans/mcp-agent-debugger-gaps.md +257 -0
- package/dist/docs/versioned/next/implementationPlans/syncdb-high-churn-fields.md +266 -0
- package/dist/docs/versioned/next/reference/environment-variables.md +2 -0
- package/dist/docs/versioned/next/reference/mcp-server.md +12 -0
- package/dist/docs/versioned/next/reference/test.md +4 -1
- package/dist/docs/versioned/next/tasks/mcp-agent-debugger-gaps.md +151 -0
- package/dist/local/localTools.d.ts.map +1 -1
- package/dist/local/localTools.js +94 -1
- package/dist/local/localTools.js.map +1 -1
- package/dist/local/metro/metroDevSession.d.ts +1 -0
- package/dist/local/metro/metroDevSession.d.ts.map +1 -1
- package/dist/local/metro/metroDevSession.js +104 -1
- package/dist/local/metro/metroDevSession.js.map +1 -1
- package/dist/local/native/nativeLogs.d.ts +12 -0
- package/dist/local/native/nativeLogs.d.ts.map +1 -0
- package/dist/local/native/nativeLogs.js +103 -0
- package/dist/local/native/nativeLogs.js.map +1 -0
- package/dist/local/tools/clientDev.d.ts +22 -0
- package/dist/local/tools/clientDev.d.ts.map +1 -0
- package/dist/local/tools/clientDev.isolated.d.ts +2 -0
- package/dist/local/tools/clientDev.isolated.d.ts.map +1 -0
- package/dist/local/tools/clientDev.isolated.js +55 -0
- package/dist/local/tools/clientDev.isolated.js.map +1 -0
- package/dist/local/tools/clientDev.js +224 -0
- package/dist/local/tools/clientDev.js.map +1 -0
- package/dist/local/tools/readLogs.d.ts.map +1 -1
- package/dist/local/tools/readLogs.js +22 -3
- package/dist/local/tools/readLogs.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +3 -1
- package/dist/tools.js.map +1 -1
- package/package.json +7 -7
- package/src/docs/templates/bootstrap/frontend/app/_layout.template.tsx +2 -0
- package/src/docs/upgrades/58.0.3.md +28 -0
- package/src/docs/versioned/next/explanation/ai-development-loop.md +10 -7
- package/src/docs/versioned/next/explanation/dependency-management.md +2 -9
- package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +13 -0
- package/src/docs/versioned/next/explanation/test-isolation.md +2 -1
- package/src/docs/versioned/next/explanation/test-sharding.md +111 -0
- package/src/docs/versioned/next/how-to/README.md +1 -0
- package/src/docs/versioned/next/how-to/circleci.md +12 -4
- package/src/docs/versioned/next/how-to/debug-with-mcp.md +10 -1
- package/src/docs/versioned/next/how-to/fix-code-scanning-alerts.md +43 -0
- package/src/docs/versioned/next/how-to/run-tests-locally.md +5 -0
- package/src/docs/versioned/next/how-to/set-up-terreno-mcp.md +3 -1
- package/src/docs/versioned/next/how-to/update-dependencies.md +1 -1
- package/src/docs/versioned/next/implementationPlans/mcp-agent-debugger-gaps.md +257 -0
- package/src/docs/versioned/next/implementationPlans/syncdb-high-churn-fields.md +266 -0
- package/src/docs/versioned/next/reference/environment-variables.md +2 -0
- package/src/docs/versioned/next/reference/mcp-server.md +12 -0
- package/src/docs/versioned/next/reference/test.md +4 -1
- package/src/docs/versioned/next/tasks/mcp-agent-debugger-gaps.md +151 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Task List: MCP Agent Debugger Gaps
|
|
2
|
+
|
|
3
|
+
See: [`docs/implementationPlans/mcp-agent-debugger-gaps.md`](../implementationPlans/mcp-agent-debugger-gaps.md)
|
|
4
|
+
|
|
5
|
+
## Instructions for the implementing agent
|
|
6
|
+
|
|
7
|
+
- Implement in phase order (1 → 5). Phases 2 and 3 may overlap after Phase 1 lands CDP Network
|
|
8
|
+
enablement.
|
|
9
|
+
- Every tool and `read_logs` source documented in `docs/reference/mcp-server.md` must be exercised
|
|
10
|
+
in Task 5.1; paste **real** JSON/text into the docs (no fabricated examples).
|
|
11
|
+
- State-changing tools (`dispatch_client_action`, `write_local_storage`, `invoke_dev_command`)
|
|
12
|
+
must refuse when `TERRENO_MCP_EVAL` is unset, matching `evaluate` / `navigate`.
|
|
13
|
+
- Run `bun run mcp:build`, `bun run compile`, and `bun run lint` before each commit. Run tests
|
|
14
|
+
under `mcp-server/` and any touched package (`syncdb`, `create-terreno-app`).
|
|
15
|
+
- Update docs in the same slice as code (`update-docs` skill conventions).
|
|
16
|
+
|
|
17
|
+
## Phase 1: CDP network capture
|
|
18
|
+
|
|
19
|
+
- [x] **Task 1.1**: Enable Network domain on the Metro CDP session
|
|
20
|
+
- Description: In `metroDevSession.ts`, after the debugger WebSocket attaches, send
|
|
21
|
+
`Network.enable` alongside `Runtime.enable`. Handle `Network.requestWillBeSent`,
|
|
22
|
+
`Network.responseReceived`, and optionally `Network.loadingFailed`. Push normalized entries
|
|
23
|
+
onto a dedicated ring with redaction for sensitive headers and truncated text bodies. Export
|
|
24
|
+
`snapshotNetworkRing()` for `readLogs`. Add unit tests with mocked WebSocket messages.
|
|
25
|
+
- Files: `mcp-server/src/local/metro/metroDevSession.ts`, `mcp-server/src/local/metro/metroDevSession.test.ts`
|
|
26
|
+
- Depends on: —
|
|
27
|
+
- Acceptance: tests cover at least one request/response pair and header redaction; ring respects
|
|
28
|
+
max size.
|
|
29
|
+
|
|
30
|
+
- [x] **Task 1.2**: Wire `network` into `read_logs` and connection status
|
|
31
|
+
- Description: Extend `readLogs.ts` to include source `network` in default merge and in
|
|
32
|
+
`sources` filtering. Include network buffer status in the JSON `connection` block (same
|
|
33
|
+
pattern as `app` / metro events). Ensure `last_error` does not treat HTTP 4xx as error
|
|
34
|
+
unless the captured entry level is `error` (network entries default to `info`).
|
|
35
|
+
- Files: `mcp-server/src/local/tools/readLogs.ts`, tests beside readLogs or metro session
|
|
36
|
+
- Depends on: Task 1.1
|
|
37
|
+
- Acceptance: `read_logs` with `sources: ["network"]` returns entries after a mocked CDP
|
|
38
|
+
response; merged output sorts by timestamp with other sources.
|
|
39
|
+
|
|
40
|
+
- [x] **Task 1.3**: Local server E2E for network source
|
|
41
|
+
- Description: Extend `localServer.e2e.test.ts` (or dedicated test) so the MCP client calls
|
|
42
|
+
`read_logs` and receives a `network`-sourced line from the test harness CDP mock — satisfies
|
|
43
|
+
E1 in the IP.
|
|
44
|
+
- Files: `mcp-server/src/local/localServer.e2e.test.ts`
|
|
45
|
+
- Depends on: Task 1.2
|
|
46
|
+
- Acceptance: E1 passes in CI; `bun run mcp:build` succeeds.
|
|
47
|
+
|
|
48
|
+
## Phase 2: Dispatch and local storage
|
|
49
|
+
|
|
50
|
+
- [x] **Task 2.1**: `registerTerrenoDevStorage` in `@terreno/syncdb`
|
|
51
|
+
- Description: Add dev-only registry on `globalThis.__TERRENO_DEV_STORAGE__` with AsyncStorage
|
|
52
|
+
wiring and optional SecureStore allowlist. Export from `@terreno/syncdb` and
|
|
53
|
+
`@terreno/syncdb/devMcpRegistry` (concrete path per no-barrel rules). Tests with mocked
|
|
54
|
+
AsyncStorage. No-op when not `__DEV__`.
|
|
55
|
+
- Files: `syncdb/src/devMcpRegistry.ts` (or split), `syncdb/src/index.ts`, tests
|
|
56
|
+
- Depends on: —
|
|
57
|
+
- Acceptance: tests prove list/get/set; production guard no-ops.
|
|
58
|
+
|
|
59
|
+
- [x] **Task 2.2**: `registerTerrenoDevCommand` in `@terreno/syncdb`
|
|
60
|
+
- Description: Dev-only map on `globalThis.__TERRENO_DEV_COMMANDS__` with register/list
|
|
61
|
+
metadata and serializable `inputSchema` (JSON Schema subset). Handler invocation only through
|
|
62
|
+
a single `runTerrenoDevCommand(name, args)` used by MCP evaluate path. Tests for register,
|
|
63
|
+
duplicate name error, and invoke.
|
|
64
|
+
- Files: same module as Task 2.1, tests
|
|
65
|
+
- Depends on: Task 2.1 (same file OK)
|
|
66
|
+
- Acceptance: handler runs in test via direct call; registry cleared between tests.
|
|
67
|
+
|
|
68
|
+
- [x] **Task 2.3**: MCP tools `dispatch_client_action`, `read_local_storage`, `write_local_storage`
|
|
69
|
+
- Description: Add tools in `localTools.ts` and handlers under `mcp-server/src/local/tools/`.
|
|
70
|
+
Implement CDP evaluate fallbacks mirroring `get_client_state` / `evaluate`. Gate writes and
|
|
71
|
+
dispatch on `TERRENO_MCP_EVAL=1`. Register schemas and descriptions (when to use vs
|
|
72
|
+
`syncdb_action`).
|
|
73
|
+
- Files: `mcp-server/src/local/localTools.ts`, new tool modules, `localTools.test.ts`
|
|
74
|
+
- Depends on: Task 1.1 (CDP), Task 2.1
|
|
75
|
+
- Acceptance: unit tests for EVAL gate, dispatch success/failure, storage read cap, write
|
|
76
|
+
rejection without EVAL.
|
|
77
|
+
|
|
78
|
+
- [x] **Task 2.4**: Wire bootstrap and example app
|
|
79
|
+
- Description: Call `registerTerrenoDevStorage({asyncStorage: true})` from bootstrap template
|
|
80
|
+
and `example-frontend/app/_layout.tsx` (with `registerTerrenoDevStore` already present).
|
|
81
|
+
Update `create-terreno-app` generated store if it duplicates layout wiring.
|
|
82
|
+
- Files: `mcp-server/src/docs/templates/bootstrap/frontend/app/_layout.template.tsx`,
|
|
83
|
+
`example-frontend/app/_layout.tsx`, `create-terreno-app/src/generate.ts` if needed
|
|
84
|
+
- Depends on: Task 2.1, Task 2.3
|
|
85
|
+
- Acceptance: example app compiles; manual smoke: `read_local_storage` returns persist keys
|
|
86
|
+
after login.
|
|
87
|
+
|
|
88
|
+
## Phase 3: Native platform logs
|
|
89
|
+
|
|
90
|
+
- [x] **Task 3.1**: Native log collectors
|
|
91
|
+
- Description: Add `mcp-server/src/local/native/` (or under `tools/`) with
|
|
92
|
+
`snapshotNativeLogs({entries})` using adb and simctl as in the IP. Respect
|
|
93
|
+
`TERRENO_NATIVE_LOGS=0` and `TERRENO_ADB_SERIAL`. Return structured `{lines, status}`.
|
|
94
|
+
- Files: new module + tests with mocked spawn
|
|
95
|
+
- Depends on: —
|
|
96
|
+
- Acceptance: tests cover happy path, missing adb, missing sim; line cap enforced.
|
|
97
|
+
|
|
98
|
+
- [x] **Task 3.2**: `read_logs` source `native`
|
|
99
|
+
- Description: Integrate Task 3.1 into `readLogs.ts`; document platform requirements in tool
|
|
100
|
+
JSON output when empty.
|
|
101
|
+
- Files: `readLogs.ts`, tests
|
|
102
|
+
- Depends on: Task 3.1
|
|
103
|
+
- Acceptance: `read_logs` with `sources: ["native"]` returns entries or explicit status.
|
|
104
|
+
|
|
105
|
+
## Phase 4: Dev command MCP surface
|
|
106
|
+
|
|
107
|
+
- [x] **Task 4.1**: MCP tools `list_dev_commands` and `invoke_dev_command`
|
|
108
|
+
- Description: List metadata from registry via in-process or CDP read. Invoke via evaluate
|
|
109
|
+
calling `runTerrenoDevCommand` (EVAL-gated). Wire in `localTools.ts`.
|
|
110
|
+
- Files: `mcp-server/src/local/tools/devCommands.ts`, `localTools.ts`, tests
|
|
111
|
+
- Depends on: Task 2.2, Task 2.3
|
|
112
|
+
- Acceptance: list returns registered commands; invoke runs example handler in test mock.
|
|
113
|
+
|
|
114
|
+
- [x] **Task 4.2**: Example dev command
|
|
115
|
+
- Description: Register one command in `example-frontend` (for example clear a dev-only
|
|
116
|
+
AsyncStorage key or flip a debug flag) and document it in how-to as the sample invoke.
|
|
117
|
+
- Files: `example-frontend/**` (small module + `_layout` import)
|
|
118
|
+
- Depends on: Task 4.1, Task 2.4
|
|
119
|
+
- Acceptance: with `TERRENO_MCP_EVAL=1`, invoke succeeds and effect observable via
|
|
120
|
+
`read_local_storage` or `get_client_state`.
|
|
121
|
+
|
|
122
|
+
## Phase 5: Documentation and verification
|
|
123
|
+
|
|
124
|
+
- [x] **Task 5.1**: Capture real tool output
|
|
125
|
+
- Description: Run example backend + frontend + Metro. Record verbatim output for: `read_logs`
|
|
126
|
+
with `network` and `native` (or status when native unavailable), `dispatch_client_action`,
|
|
127
|
+
`read_local_storage`, `write_local_storage`, `list_dev_commands`, `invoke_dev_command`.
|
|
128
|
+
Save transcripts under `/opt/cursor/artifacts/` or `.terreno/pipeline/` for doc authors.
|
|
129
|
+
- Files: none (evidence bundle)
|
|
130
|
+
- Depends on: Tasks 1.3, 3.2, 4.2
|
|
131
|
+
- Acceptance: evidence file paths referenced in PR body; every new surface has at least one
|
|
132
|
+
captured sample.
|
|
133
|
+
|
|
134
|
+
- [x] **Task 5.2**: Update reference and explainer docs
|
|
135
|
+
- Description: Update `docs/reference/mcp-server.md` (tool tables, env vars,
|
|
136
|
+
can/cannot-see), `docs/how-to/debug-with-mcp.md` (symptom → tool table rows for wrong API
|
|
137
|
+
data, auth token in storage, native-only crash), `docs/explanation/ai-development-loop.md`
|
|
138
|
+
(Observe stage + cannot-see adjustments), `docs/reference/environment-variables.md`,
|
|
139
|
+
`mcp-server/README.md`. Use Task 5.1 outputs only.
|
|
140
|
+
- Files: listed above
|
|
141
|
+
- Depends on: Task 5.1
|
|
142
|
+
- Acceptance: grep for new tool names in reference matches `localTools.ts`; loop diagram
|
|
143
|
+
mentions `network` and `native` sources.
|
|
144
|
+
|
|
145
|
+
- [x] **Task 5.3**: Browser E2E or documented CI skip
|
|
146
|
+
- Description: Add `example-frontend/e2e/mcp-network-debug.spec.ts` per E2 if feasible; if Metro
|
|
147
|
+
CDP is not available in CI, document skip in spec comment and IP Activity Log; ensure E1
|
|
148
|
+
still satisfies automated proof.
|
|
149
|
+
- Files: `example-frontend/e2e/mcp-network-debug.spec.ts` (optional)
|
|
150
|
+
- Depends on: Task 5.2
|
|
151
|
+
- Acceptance: E2 runs in `bun run frontend:e2e` or IP records why not.
|