From 406663c36bb39081d96129c2350715082509e1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 5 Nov 2026 09:57:03 +0100 Subject: [PATCH 1/3] docs(help): route stale React Native state to reads, not UI navigation --- src/commands/schema/cli-help-react-native.ts | 84 ++++++++++++++++++++ src/commands/schema/cli-help-topics.test.ts | 2 + src/commands/schema/cli-help.ts | 79 +----------------- 3 files changed, 88 insertions(+), 77 deletions(-) create mode 100644 src/commands/schema/cli-help-react-native.ts diff --git a/src/commands/schema/cli-help-react-native.ts b/src/commands/schema/cli-help-react-native.ts new file mode 100644 index 0000000000..23e5079ec1 --- /dev/null +++ b/src/commands/schema/cli-help-react-native.ts @@ -0,0 +1,84 @@ +export const reactNativeHelpTopic = { + summary: 'React Native app automation hazards and routing', + body: `agent-device help react-native + +Use this when the target app is React Native, Expo, or a React Native dev client. +This topic covers React Native-specific automation hazards and routes deeper +questions to the owning help topic. + +Choose the next help topic: + Routine QA/dogfood/manual-test flow (open, snapshot -i, press/fill --settle, verify, close): help manual-qa; it has the concrete command shapes, so you should not need generic navigation help for a normal pass. + Deep exploration of navigation/selector/ref edge cases, or a serial-command question manual-qa does not answer: help workflow (full reference, larger read). + Logs, network, diagnostics, traces, permission dialogs, or runtime failures: help debugging. + Component tree, props/state/hooks, slow renders, rerenders, render causes, or dropped frames in React: help react-devtools. + JS heap growth, heap snapshots, allocation hotspots, or retained-object leaks: help cdp. + A wrong or stale value that may come from app state or storage (AsyncStorage, MMKV, a feature flag): see Stale state below. + Remote/cloud config, leases, and local service tunnels: help remote. + +React Native dev loop: + Do not run doctor as routine QA/dogfood prep. Use doctor only when the user asks for setup diagnostics or a command failure points to an unhealthy device, runner, dev-server, or remote environment. + For "start from screen X" flows, prefer open --relaunch before the first snapshot so the app does not reuse a prior in-progress navigation state. + JS-only change with Metro or Re.Pack connected: + agent-device metro reload + agent-device find "Home" + Do not use agent-device reload. Use open --relaunch for native startup reset. + Android RN/Expo/Re.Pack dev server: direct Android localhost URL opens with a port auto-configure host reachability. For app/package launches, run metro prepare when the app cannot reach the local dev server. + Verify Metro/Re.Pack from the same host context that owns the dev server. If a sandboxed shell cannot curl localhost:8081/status but an unrestricted host shell can, the dev server is running and the sandbox probe is not authoritative. + adb reverse only affects Android device-to-host traffic. It does not prove host-to-dev-server reachability, and it does not fix a redbox caused by a stale or wrong bundle/app state. + Multiple local worktrees can reuse one native iOS simulator build by running each worktree's dev server on a different port and opening the same installed app on different simulators with explicit runtime hints: + agent-device open "React Navigation Example" --platform ios --device "iPhone 17" --session rn-a --metro-host 127.0.0.1 --metro-port 8081 --relaunch + agent-device open "React Navigation Example" --platform ios --device "iPhone 17 Pro" --session rn-b --metro-host 127.0.0.1 --metro-port 8082 --relaunch + iOS simulator opens write bare React Native's per-simulator debug server settings before launch. Detected Expo development clients receive their server URL through a launch link instead. Use separate sessions/devices, close both sessions when done, and rebuild only for native changes or dependency changes that affect the binary. One simulator cannot run two copies of the same bundle id. + Expo Go/dev clients are host shells. Use provided project URLs, verify with snapshot -i after opening, and ask instead of inventing app ids or URLs. Help workflow owns the full Expo URL command shapes. + +Overlays and busy RN UIs: + If snapshot reports a React Native warning/error overlay, handle it before interacting with the app: run agent-device react-native dismiss-overlay. The command sends the safe LogBox/RedBox action and verifies the overlay is gone with a fresh post-dismiss snapshot -i. + If the command reports the overlay is still visible, use screenshot --overlay-refs for visual evidence and report the overlay instead of pressing warning/error text manually. + Do not manually press warning/error text bodies, collapsed banner bodies, full-screen warning parents, or broad LogBox/RedBox refs. The dismiss-overlay command owns the narrow LogBox/RedBox targeting policy. + Report the overlay in the final summary. Use screenshot --overlay-refs before dismissing only if visual evidence is required. + Minimal overlay continuation: + agent-device snapshot -i + agent-device react-native dismiss-overlay + agent-device snapshot -i + agent-device press 'id="submit-order"' + Do not use a plain snapshot after dismiss-overlay when the next step needs current refs; use snapshot -i. + When overlay evidence is required before continuing, keep the sequence explicit: + agent-device snapshot -i + agent-device screenshot --overlay-refs + agent-device react-native dismiss-overlay + agent-device snapshot -i + agent-device press 'id="submit-order"' + If snapshot times out because the UI never becomes idle, Android accessibility may be blocked by busy or continuously changing app UI. After that timeout, use screenshot as visual truth instead of repeatedly retrying snapshots. + If iOS snapshot reports AX unavailable or returns only a sparse root, the current screen's accessibility state is invalid. Use plain screenshot as visual truth, coordinate navigation to leave the bad screen, then take a fresh snapshot -i before returning to selector/@ref commands. + agent-device screenshot + agent-device press 124 817 + agent-device snapshot -i + Android runtime permission dialogs and native alerts are handled by alert wait/accept/dismiss. If alert reports no alert but a sheet is visible, alert did not recognize it: use snapshot -i and press @ref on the visible button. + +React DevTools routing: + Keep the agent-device react-devtools prefix on every React DevTools command. + Use help react-devtools for component trees, props/state/hooks, render profiles, slow renders, rerenders, and their causes. + If React DevTools cannot attach, report the error and continue with logs, network, perf frames, perf memory, screenshot, and trace evidence instead of blocking the whole flow. + +CDP memory routing: + Keep the agent-device cdp prefix on every CDP command. + Use help cdp for JS heap usage samples, heap snapshots, snapshot diffs, leak-triplet analysis, allocation hotspots, and retained-object paths. + Use perf memory sample or perf memory snapshot for native/process memory; use cdp only for JavaScript heap evidence. + +Stale state: + If a wrong or stale value may come from app state or storage, read the value. Do not navigate the UI to infer it. + JS state through Metro, after cdp target select (help cdp): + agent-device cdp runtime eval --expr '' --await + Stored AsyncStorage on an iOS simulator is under the data container from xcrun simctl get_app_container data, in Library/Application Support//RCTAsyncLocalStorage_V1. On Android, read databases/RKStorage with adb shell run-as . + +Slow-flow investigation: + Keep one session, open the app first, and snapshot -i before interacting. + Start React Native slow-flow plans with this ordered scaffold: + agent-device open "Agent Device Tester" --platform android + agent-device snapshot -i + If the task says to open the app, include the open command even when it also describes the current screen. + Use help react-devtools for the narrow React profile window: react-devtools profile start right before the interaction and react-devtools profile stop after it. + Use help debugging for logs clear --restart, logs mark, network dump --include headers, perf frames, perf memory, native profiles, traces, and runtime failure evidence. + For 15-20s async work, use wait with the exact expected text or selector instead of repeated snapshots. + Report React render offenders separately from network/backend waits and device frame/CPU/memory findings.`, +}; diff --git a/src/commands/schema/cli-help-topics.test.ts b/src/commands/schema/cli-help-topics.test.ts index 644b790efc..063bc7eb14 100644 --- a/src/commands/schema/cli-help-topics.test.ts +++ b/src/commands/schema/cli-help-topics.test.ts @@ -624,6 +624,8 @@ test('usageForCommand resolves react-native help topic', async () => { assert.match(help, /agent-device react-native dismiss-overlay/); assert.match(help, /verifies the overlay is gone with a fresh post-dismiss snapshot -i/); assert.match(help, /Do not use a plain snapshot after dismiss-overlay/); + assert.match(help, /agent-device cdp runtime eval --expr '' --await/); + assert.match(help, /RCTAsyncLocalStorage_V1/); assert.match(help, /When overlay evidence is required before continuing/); assert.match(help, /overlay is still visible/); assert.match(help, /Do not manually press warning\/error text bodies/); diff --git a/src/commands/schema/cli-help.ts b/src/commands/schema/cli-help.ts index 14f7480c60..b00090b8e7 100644 --- a/src/commands/schema/cli-help.ts +++ b/src/commands/schema/cli-help.ts @@ -21,6 +21,7 @@ import { } from './cli-help-workflows.ts'; import { renderCliHelpOverview } from './cli-help-overview.ts'; import { foldableHelpTopic } from './cli-help-foldable.ts'; +import { reactNativeHelpTopic } from './cli-help-react-native.ts'; import { TV_PLUGIN_FLOWS } from './cli-help-tv.ts'; import { providerPluginHelp } from '../provider-plugin-catalog.ts'; @@ -366,83 +367,7 @@ Output contract: Target caveats: React Native/Hermes implements a subset of browser CDP. If a command reports an unsupported method, keep the target selected and switch to heap usage samples plus heap snapshots. Prefer react-devtools profile for render causes; prefer perf memory sample or perf memory snapshot for native/process memory.`, }, - 'react-native': { - summary: 'React Native app automation hazards and routing', - body: `agent-device help react-native - -Use this when the target app is React Native, Expo, or a React Native dev client. -This topic covers React Native-specific automation hazards and routes deeper -questions to the owning help topic. - -Choose the next help topic: - Routine QA/dogfood/manual-test flow (open, snapshot -i, press/fill --settle, verify, close): help manual-qa; it has the concrete command shapes, so you should not need generic navigation help for a normal pass. - Deep exploration of navigation/selector/ref edge cases, or a serial-command question manual-qa does not answer: help workflow (full reference, larger read). - Logs, network, diagnostics, traces, permission dialogs, or runtime failures: help debugging. - Component tree, props/state/hooks, slow renders, rerenders, render causes, or dropped frames in React: help react-devtools. - JS heap growth, heap snapshots, allocation hotspots, or retained-object leaks: help cdp. - Remote/cloud config, leases, and local service tunnels: help remote. - -React Native dev loop: - Do not run doctor as routine QA/dogfood prep. Use doctor only when the user asks for setup diagnostics or a command failure points to an unhealthy device, runner, dev-server, or remote environment. - For "start from screen X" flows, prefer open --relaunch before the first snapshot so the app does not reuse a prior in-progress navigation state. - JS-only change with Metro or Re.Pack connected: - agent-device metro reload - agent-device find "Home" - Do not use agent-device reload. Use open --relaunch for native startup reset. - Android RN/Expo/Re.Pack dev server: direct Android localhost URL opens with a port auto-configure host reachability. For app/package launches, run metro prepare when the app cannot reach the local dev server. - Verify Metro/Re.Pack from the same host context that owns the dev server. If a sandboxed shell cannot curl localhost:8081/status but an unrestricted host shell can, the dev server is running and the sandbox probe is not authoritative. - adb reverse only affects Android device-to-host traffic. It does not prove host-to-dev-server reachability, and it does not fix a redbox caused by a stale or wrong bundle/app state. - Multiple local worktrees can reuse one native iOS simulator build by running each worktree's dev server on a different port and opening the same installed app on different simulators with explicit runtime hints: - agent-device open "React Navigation Example" --platform ios --device "iPhone 17" --session rn-a --metro-host 127.0.0.1 --metro-port 8081 --relaunch - agent-device open "React Navigation Example" --platform ios --device "iPhone 17 Pro" --session rn-b --metro-host 127.0.0.1 --metro-port 8082 --relaunch - iOS simulator opens write bare React Native's per-simulator debug server settings before launch. Detected Expo development clients receive their server URL through a launch link instead. Use separate sessions/devices, close both sessions when done, and rebuild only for native changes or dependency changes that affect the binary. One simulator cannot run two copies of the same bundle id. - Expo Go/dev clients are host shells. Use provided project URLs, verify with snapshot -i after opening, and ask instead of inventing app ids or URLs. Help workflow owns the full Expo URL command shapes. - -Overlays and busy RN UIs: - If snapshot reports a React Native warning/error overlay, handle it before interacting with the app: run agent-device react-native dismiss-overlay. The command sends the safe LogBox/RedBox action and verifies the overlay is gone with a fresh post-dismiss snapshot -i. - If the command reports the overlay is still visible, use screenshot --overlay-refs for visual evidence and report the overlay instead of pressing warning/error text manually. - Do not manually press warning/error text bodies, collapsed banner bodies, full-screen warning parents, or broad LogBox/RedBox refs. The dismiss-overlay command owns the narrow LogBox/RedBox targeting policy. - Report the overlay in the final summary. Use screenshot --overlay-refs before dismissing only if visual evidence is required. - Minimal overlay continuation: - agent-device snapshot -i - agent-device react-native dismiss-overlay - agent-device snapshot -i - agent-device press 'id="submit-order"' - Do not use a plain snapshot after dismiss-overlay when the next step needs current refs; use snapshot -i. - When overlay evidence is required before continuing, keep the sequence explicit: - agent-device snapshot -i - agent-device screenshot --overlay-refs - agent-device react-native dismiss-overlay - agent-device snapshot -i - agent-device press 'id="submit-order"' - If snapshot times out because the UI never becomes idle, Android accessibility may be blocked by busy or continuously changing app UI. After that timeout, use screenshot as visual truth instead of repeatedly retrying snapshots. - If iOS snapshot reports AX unavailable or returns only a sparse root, the current screen's accessibility state is invalid. Use plain screenshot as visual truth, coordinate navigation to leave the bad screen, then take a fresh snapshot -i before returning to selector/@ref commands. - agent-device screenshot - agent-device press 124 817 - agent-device snapshot -i - Android runtime permission dialogs and native alerts are handled by alert wait/accept/dismiss. If alert reports no alert but a sheet is visible, alert did not recognize it: use snapshot -i and press @ref on the visible button. - -React DevTools routing: - Keep the agent-device react-devtools prefix on every React DevTools command. - Use help react-devtools for component trees, props/state/hooks, render profiles, slow renders, rerenders, and their causes. - If React DevTools cannot attach, report the error and continue with logs, network, perf frames, perf memory, screenshot, and trace evidence instead of blocking the whole flow. - -CDP memory routing: - Keep the agent-device cdp prefix on every CDP command. - Use help cdp for JS heap usage samples, heap snapshots, snapshot diffs, leak-triplet analysis, allocation hotspots, and retained-object paths. - Use perf memory sample or perf memory snapshot for native/process memory; use cdp only for JavaScript heap evidence. - -Slow-flow investigation: - Keep one session, open the app first, and snapshot -i before interacting. - Start React Native slow-flow plans with this ordered scaffold: - agent-device open "Agent Device Tester" --platform android - agent-device snapshot -i - If the task says to open the app, include the open command even when it also describes the current screen. - Use help react-devtools for the narrow React profile window: react-devtools profile start right before the interaction and react-devtools profile stop after it. - Use help debugging for logs clear --restart, logs mark, network dump --include headers, perf frames, perf memory, native profiles, traces, and runtime failure evidence. - For 15-20s async work, use wait with the exact expected text or selector instead of repeated snapshots. - Report React render offenders separately from network/backend waits and device frame/CPU/memory findings.`, - }, + 'react-native': reactNativeHelpTopic, 'physical-device': { summary: 'Connected phone/tablet setup and iOS signing prerequisites', body: `agent-device help physical-device From d907af0a3c0b1a6f92e07aa8972252eb6c293e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 5 Nov 2026 19:09:18 +0100 Subject: [PATCH 2/3] docs(help): qualify RN storage recipes and move runtime eval to the cdp topic Co-Authored-By: Claude Sonnet 5.5 --- src/commands/schema/cli-help-react-native.ts | 8 +++++--- src/commands/schema/cli-help-topics.test.ts | 19 +++++++++++++++++-- src/commands/schema/cli-help.ts | 5 +++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/commands/schema/cli-help-react-native.ts b/src/commands/schema/cli-help-react-native.ts index 23e5079ec1..7e7fc7f1d5 100644 --- a/src/commands/schema/cli-help-react-native.ts +++ b/src/commands/schema/cli-help-react-native.ts @@ -67,9 +67,11 @@ CDP memory routing: Stale state: If a wrong or stale value may come from app state or storage, read the value. Do not navigate the UI to infer it. - JS state through Metro, after cdp target select (help cdp): - agent-device cdp runtime eval --expr '' --await - Stored AsyncStorage on an iOS simulator is under the data container from xcrun simctl get_app_container data, in Library/Application Support//RCTAsyncLocalStorage_V1. On Android, read databases/RKStorage with adb shell run-as . + Read JS state through Metro with help cdp. It owns the runtime eval command shape and which globals the expression can reach. + Stored AsyncStorage files are a fallback for debuggable builds on a local simulator or emulator only. They need host shell access, so they do not work on a remote lease. Use help cdp there. + iOS simulator, AsyncStorage 1.x/2.x layout: Library/Application Support//RCTAsyncLocalStorage_V1 under the data container from xcrun simctl get_app_container data. + Android, AsyncStorage 1.x/2.x layout: databases/RKStorage through adb shell run-as . run-as needs a debuggable package. + If those files are missing, the app may use a newer store (AsyncStorage 3.x uses SQLite). Do not conclude the value is absent; read it through help cdp instead. Slow-flow investigation: Keep one session, open the app first, and snapshot -i before interacting. diff --git a/src/commands/schema/cli-help-topics.test.ts b/src/commands/schema/cli-help-topics.test.ts index 063bc7eb14..6f193bc658 100644 --- a/src/commands/schema/cli-help-topics.test.ts +++ b/src/commands/schema/cli-help-topics.test.ts @@ -585,6 +585,9 @@ test('usageForCommand resolves cdp help topic', async () => { assert.match(help, /Until cdp has a compact leak report command/); assert.match(help, /Avoid cdp profile cpu, trace, network, and console by default/); assert.match(help, /React Native\/Hermes implements a subset of browser CDP/); + assert.match(help, /agent-device cdp runtime eval --expr '' --await/); + assert.match(help, /--expr runs in the selected target's JS global scope/); + assert.match(help, /including AsyncStorage, are not globals unless the app exposes them/); }); test('usageForCommand resolves react-native help topic', async () => { @@ -624,8 +627,20 @@ test('usageForCommand resolves react-native help topic', async () => { assert.match(help, /agent-device react-native dismiss-overlay/); assert.match(help, /verifies the overlay is gone with a fresh post-dismiss snapshot -i/); assert.match(help, /Do not use a plain snapshot after dismiss-overlay/); - assert.match(help, /agent-device cdp runtime eval --expr '' --await/); - assert.match(help, /RCTAsyncLocalStorage_V1/); + assert.doesNotMatch(help, /runtime eval --expr/); + assert.match(help, /Read JS state through Metro with help cdp/); + assert.match(help, /debuggable builds on a local simulator or emulator only/); + assert.match(help, /so they do not work on a remote lease/); + assert.match( + help, + /AsyncStorage 1\.x\/2\.x layout: Library\/Application Support\/\/RCTAsyncLocalStorage_V1/, + ); + assert.match( + help, + /AsyncStorage 1\.x\/2\.x layout: databases\/RKStorage through adb shell run-as /, + ); + assert.match(help, /run-as needs a debuggable package/); + assert.match(help, /newer store \(AsyncStorage 3\.x uses SQLite\)/); assert.match(help, /When overlay evidence is required before continuing/); assert.match(help, /overlay is still visible/); assert.match(help, /Do not manually press warning\/error text bodies/); diff --git a/src/commands/schema/cli-help.ts b/src/commands/schema/cli-help.ts index b00090b8e7..f1b8fa19a1 100644 --- a/src/commands/schema/cli-help.ts +++ b/src/commands/schema/cli-help.ts @@ -361,6 +361,11 @@ Recommended subset: Use cdp memory usage, memory snapshot, memory allocation, and targeted runtime eval. Avoid cdp profile cpu, trace, network, and console by default because agent-device already has perf cpu, trace, network, logs, and react-devtools guidance for those areas. +Runtime eval: + Read a JS value after cdp target select. This route does not depend on the host shell, the storage layout, or the app being local: + agent-device cdp runtime eval --expr '' --await + --expr runs in the selected target's JS global scope. It reaches only values the app exposes there. Module imports, including AsyncStorage, are not globals unless the app exposes them. If the expression cannot reach the value, report that. Do not guess. + Output contract: Until cdp has a compact leak report command, synthesize one from memory usage diff, snapshot diff, leak-triplet, and retainers. Report heap deltas, top retained classes/shapes, leak-triplet rows that stayed high after cleanup, and the shortest useful retaining paths. Do not paste raw heap snapshots or large allocation profiles into the response; use exported artifacts only when the user asks for raw data. From d43b18dd82221dab09e6884811734eb51824b69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 6 Nov 2026 05:48:18 +0100 Subject: [PATCH 3/3] docs(help): shorten the stale-state and runtime eval guidance --- src/commands/schema/cli-help-react-native.ts | 11 +++++----- src/commands/schema/cli-help-topics.test.ts | 22 +++++++------------- src/commands/schema/cli-help.ts | 5 ++--- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/commands/schema/cli-help-react-native.ts b/src/commands/schema/cli-help-react-native.ts index 7e7fc7f1d5..6db1cedead 100644 --- a/src/commands/schema/cli-help-react-native.ts +++ b/src/commands/schema/cli-help-react-native.ts @@ -66,12 +66,11 @@ CDP memory routing: Use perf memory sample or perf memory snapshot for native/process memory; use cdp only for JavaScript heap evidence. Stale state: - If a wrong or stale value may come from app state or storage, read the value. Do not navigate the UI to infer it. - Read JS state through Metro with help cdp. It owns the runtime eval command shape and which globals the expression can reach. - Stored AsyncStorage files are a fallback for debuggable builds on a local simulator or emulator only. They need host shell access, so they do not work on a remote lease. Use help cdp there. - iOS simulator, AsyncStorage 1.x/2.x layout: Library/Application Support//RCTAsyncLocalStorage_V1 under the data container from xcrun simctl get_app_container data. - Android, AsyncStorage 1.x/2.x layout: databases/RKStorage through adb shell run-as . run-as needs a debuggable package. - If those files are missing, the app may use a newer store (AsyncStorage 3.x uses SQLite). Do not conclude the value is absent; read it through help cdp instead. + If a wrong or stale value may come from app state or storage, read the value. Do not navigate the UI to infer it. Read JS values with help cdp (runtime eval). + Fallback for debuggable builds on a local simulator or emulator, not a remote lease: read the AsyncStorage 1.x/2.x files. + iOS: Library/Application Support//RCTAsyncLocalStorage_V1 in xcrun simctl get_app_container data + Android: databases/RKStorage through adb shell run-as + Missing files can mean a newer store (AsyncStorage 3.x). Do not conclude that the value is absent. Slow-flow investigation: Keep one session, open the app first, and snapshot -i before interacting. diff --git a/src/commands/schema/cli-help-topics.test.ts b/src/commands/schema/cli-help-topics.test.ts index 6f193bc658..a73a2b4b90 100644 --- a/src/commands/schema/cli-help-topics.test.ts +++ b/src/commands/schema/cli-help-topics.test.ts @@ -586,8 +586,8 @@ test('usageForCommand resolves cdp help topic', async () => { assert.match(help, /Avoid cdp profile cpu, trace, network, and console by default/); assert.match(help, /React Native\/Hermes implements a subset of browser CDP/); assert.match(help, /agent-device cdp runtime eval --expr '' --await/); - assert.match(help, /--expr runs in the selected target's JS global scope/); - assert.match(help, /including AsyncStorage, are not globals unless the app exposes them/); + assert.match(help, /--expr reaches only globals the app exposes/); + assert.match(help, /Module imports, such as AsyncStorage, are not globals/); }); test('usageForCommand resolves react-native help topic', async () => { @@ -628,19 +628,11 @@ test('usageForCommand resolves react-native help topic', async () => { assert.match(help, /verifies the overlay is gone with a fresh post-dismiss snapshot -i/); assert.match(help, /Do not use a plain snapshot after dismiss-overlay/); assert.doesNotMatch(help, /runtime eval --expr/); - assert.match(help, /Read JS state through Metro with help cdp/); - assert.match(help, /debuggable builds on a local simulator or emulator only/); - assert.match(help, /so they do not work on a remote lease/); - assert.match( - help, - /AsyncStorage 1\.x\/2\.x layout: Library\/Application Support\/\/RCTAsyncLocalStorage_V1/, - ); - assert.match( - help, - /AsyncStorage 1\.x\/2\.x layout: databases\/RKStorage through adb shell run-as /, - ); - assert.match(help, /run-as needs a debuggable package/); - assert.match(help, /newer store \(AsyncStorage 3\.x uses SQLite\)/); + assert.match(help, /Read JS values with help cdp/); + assert.match(help, /debuggable builds on a local simulator or emulator, not a remote lease/); + assert.match(help, /iOS: Library\/Application Support\/\/RCTAsyncLocalStorage_V1/); + assert.match(help, /Android: databases\/RKStorage through adb shell run-as /); + assert.match(help, /Missing files can mean a newer store/); assert.match(help, /When overlay evidence is required before continuing/); assert.match(help, /overlay is still visible/); assert.match(help, /Do not manually press warning\/error text bodies/); diff --git a/src/commands/schema/cli-help.ts b/src/commands/schema/cli-help.ts index f1b8fa19a1..992c35e736 100644 --- a/src/commands/schema/cli-help.ts +++ b/src/commands/schema/cli-help.ts @@ -362,9 +362,8 @@ Recommended subset: Avoid cdp profile cpu, trace, network, and console by default because agent-device already has perf cpu, trace, network, logs, and react-devtools guidance for those areas. Runtime eval: - Read a JS value after cdp target select. This route does not depend on the host shell, the storage layout, or the app being local: - agent-device cdp runtime eval --expr '' --await - --expr runs in the selected target's JS global scope. It reaches only values the app exposes there. Module imports, including AsyncStorage, are not globals unless the app exposes them. If the expression cannot reach the value, report that. Do not guess. + After cdp target select, read a JS value: agent-device cdp runtime eval --expr '' --await + --expr reaches only globals the app exposes. Module imports, such as AsyncStorage, are not globals. If it cannot reach the value, report that. Do not guess. Output contract: Until cdp has a compact leak report command, synthesize one from memory usage diff, snapshot diff, leak-triplet, and retainers. Report heap deltas, top retained classes/shapes, leak-triplet rows that stayed high after cleanup, and the shortest useful retaining paths. Do not paste raw heap snapshots or large allocation profiles into the response; use exported artifacts only when the user asks for raw data.