react-native-ai-devtools 1.4.24 → 1.4.25
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/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
An MCP server that gives AI assistants real-time access to a running React Native app. It bridges the gap between static code and live runtime, turning AI assistants from guessing machines into informed development partners.
|
|
4
4
|
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/igorzheludkov/react-native-ai-devtools/main/docs/demo/get_logs_demo.gif" alt="React Native AI DevTools demo" width="800" />
|
|
7
|
+
</p>
|
|
8
|
+
|
|
5
9
|
**Positioning:** This is not a debugger. This is not a QA tool. This is a Runtime AI Bridge — the missing layer between AI coding assistants and live mobile applications. Without it, your AI assistant is blind. With it, the AI sees everything happening in your app in real time.
|
|
6
10
|
|
|
7
11
|
## Feedback & Feature Requests
|
|
@@ -71,7 +75,7 @@ Add `env` to your MCP server configuration:
|
|
|
71
75
|
```json
|
|
72
76
|
{
|
|
73
77
|
"mcpServers": {
|
|
74
|
-
"rn-
|
|
78
|
+
"rn-ai-devtools": {
|
|
75
79
|
"type": "stdio",
|
|
76
80
|
"command": "npx",
|
|
77
81
|
"args": ["react-native-ai-devtools"],
|
|
@@ -125,13 +129,13 @@ No installation required - Claude Code uses `npx` to run the latest version auto
|
|
|
125
129
|
### Global (all projects)
|
|
126
130
|
|
|
127
131
|
```bash
|
|
128
|
-
claude mcp add rn-
|
|
132
|
+
claude mcp add rn-ai-devtools --scope user -- npx react-native-ai-devtools
|
|
129
133
|
```
|
|
130
134
|
|
|
131
135
|
### Project-specific
|
|
132
136
|
|
|
133
137
|
```bash
|
|
134
|
-
claude mcp add rn-
|
|
138
|
+
claude mcp add rn-ai-devtools --scope project -- npx react-native-ai-devtools
|
|
135
139
|
```
|
|
136
140
|
|
|
137
141
|
### Manual Configuration
|
|
@@ -141,7 +145,7 @@ Add to `~/.claude.json` (user scope) or `.mcp.json` (project scope):
|
|
|
141
145
|
```json
|
|
142
146
|
{
|
|
143
147
|
"mcpServers": {
|
|
144
|
-
"rn-
|
|
148
|
+
"rn-ai-devtools": {
|
|
145
149
|
"type": "stdio",
|
|
146
150
|
"command": "npx",
|
|
147
151
|
"args": ["react-native-ai-devtools"]
|
|
@@ -163,7 +167,7 @@ Requires VS Code 1.102+ with Copilot ([docs](https://code.visualstudio.com/docs/
|
|
|
163
167
|
```json
|
|
164
168
|
{
|
|
165
169
|
"servers": {
|
|
166
|
-
"rn-
|
|
170
|
+
"rn-ai-devtools": {
|
|
167
171
|
"type": "stdio",
|
|
168
172
|
"command": "npx",
|
|
169
173
|
"args": ["-y", "react-native-ai-devtools"]
|
|
@@ -183,7 +187,7 @@ Requires VS Code 1.102+ with Copilot ([docs](https://code.visualstudio.com/docs/
|
|
|
183
187
|
```json
|
|
184
188
|
{
|
|
185
189
|
"mcpServers": {
|
|
186
|
-
"rn-
|
|
190
|
+
"rn-ai-devtools": {
|
|
187
191
|
"command": "npx",
|
|
188
192
|
"args": ["-y", "react-native-ai-devtools"]
|
|
189
193
|
}
|
|
@@ -367,7 +371,7 @@ To disable telemetry and auto-registration, add `RN_DEBUGGER_TELEMETRY` to the `
|
|
|
367
371
|
```json
|
|
368
372
|
{
|
|
369
373
|
"mcpServers": {
|
|
370
|
-
"rn-
|
|
374
|
+
"rn-ai-devtools": {
|
|
371
375
|
"type": "stdio",
|
|
372
376
|
"command": "npx",
|
|
373
377
|
"args": ["react-native-ai-devtools"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDetection.d.ts","sourceRoot":"","sources":["../../src/core/appDetection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"appDetection.d.ts","sourceRoot":"","sources":["../../src/core/appDetection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,YAAY,CAAC;AAwDnE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAuB5D"}
|
|
@@ -3,15 +3,38 @@ import { getNextMessageId } from "./state.js";
|
|
|
3
3
|
import { trackAppDetection } from "./telemetry.js";
|
|
4
4
|
const DETECTION_TIMEOUT_MS = 3000;
|
|
5
5
|
const DETECTION_DELAY_MS = 500;
|
|
6
|
-
|
|
6
|
+
// Detection expression — returns a Promise (used with awaitPromise: true).
|
|
7
|
+
// The .then() defers to a microtask so the RN module system is fully initialized.
|
|
8
|
+
// Fallback paths for PlatformConstants:
|
|
9
|
+
// 1. nativeModuleProxy.PlatformConstants (Bridgeless / New Arch)
|
|
10
|
+
// 2. __turboModuleProxy('PlatformConstants') (TurboModules)
|
|
11
|
+
// 3. __fbBatchedBridgeConfig.remoteModuleConfig (Old Arch Bridge — inlined constants)
|
|
12
|
+
// 4. nativeRequireModuleConfig (Old Arch Bridge — lazy load)
|
|
13
|
+
// Always returns arch/engine even when version is unavailable.
|
|
14
|
+
const DETECTION_EXPRESSION = `Promise.resolve().then(function(){
|
|
15
|
+
var r={},c=null,p=globalThis.nativeModuleProxy;
|
|
16
|
+
if(p&&p.PlatformConstants){c=typeof p.PlatformConstants.getConstants==='function'?p.PlatformConstants.getConstants():p.PlatformConstants}
|
|
17
|
+
if(!c&&typeof globalThis.__turboModuleProxy==='function'){try{var tm=globalThis.__turboModuleProxy('PlatformConstants');if(tm)c=typeof tm.getConstants==='function'?tm.getConstants():tm}catch(e){}}
|
|
18
|
+
if(!c){var bc=globalThis.__fbBatchedBridgeConfig;if(bc&&bc.remoteModuleConfig){for(var i=0;i<bc.remoteModuleConfig.length;i++){var mc=bc.remoteModuleConfig[i];if(mc&&mc[0]==='PlatformConstants'&&mc[1]){c=mc[1];break}}}}
|
|
19
|
+
if(!c&&typeof globalThis.nativeRequireModuleConfig==='function'){try{var nc=globalThis.nativeRequireModuleConfig('PlatformConstants');if(typeof nc==='string')nc=JSON.parse(nc);if(nc&&nc[1])c=nc[1]}catch(e){}}
|
|
20
|
+
if(c){if(c.reactNativeVersion)r.rnVersion=c.reactNativeVersion;if(c.osVersion)r.osVersion=c.osVersion;if(c.systemName)r.systemName=c.systemName}
|
|
21
|
+
r.newArch=typeof globalThis.nativeFabricUIManager==='object';
|
|
22
|
+
r.hermes=typeof globalThis.HermesInternal!=='undefined';
|
|
23
|
+
var ep=p&&p.ExpoConstants;if(!ep&&typeof globalThis.__turboModuleProxy==='function'){try{ep=globalThis.__turboModuleProxy('ExpoConstants')}catch(e){}}
|
|
24
|
+
if(ep){try{var ec=typeof ep.getConstants==='function'?ep.getConstants():ep;if(ec&&ec.expoConfig&&ec.expoConfig.sdkVersion)r.expoSdk=ec.expoConfig.sdkVersion}catch(e){}}
|
|
25
|
+
return r})`;
|
|
7
26
|
function formatVersion(v) {
|
|
8
27
|
return `${v.major}.${v.minor}.${v.patch}`;
|
|
9
28
|
}
|
|
10
29
|
function parseDetectionResult(raw, platform) {
|
|
11
|
-
if (!raw
|
|
30
|
+
if (!raw)
|
|
31
|
+
return null;
|
|
32
|
+
// Accept partial results — arch/engine are always detectable even when
|
|
33
|
+
// PlatformConstants is unavailable (e.g., Old Arch without nativeModuleProxy)
|
|
34
|
+
if (raw.newArch === undefined && raw.hermes === undefined && !raw.rnVersion)
|
|
12
35
|
return null;
|
|
13
36
|
return {
|
|
14
|
-
reactNativeVersion: formatVersion(raw.rnVersion),
|
|
37
|
+
reactNativeVersion: raw.rnVersion ? formatVersion(raw.rnVersion) : "unknown",
|
|
15
38
|
architecture: raw.newArch ? "new" : "old",
|
|
16
39
|
jsEngine: raw.hermes ? "hermes" : "jsc",
|
|
17
40
|
appPlatform: platform,
|
|
@@ -36,7 +59,9 @@ export function scheduleAppDetection(app) {
|
|
|
36
59
|
if (parsed) {
|
|
37
60
|
app.appDetection = parsed;
|
|
38
61
|
trackAppDetection(parsed);
|
|
39
|
-
|
|
62
|
+
const versionStr = parsed.reactNativeVersion !== "unknown"
|
|
63
|
+
? `RN ${parsed.reactNativeVersion}, ` : "";
|
|
64
|
+
console.error(`[rn-ai-debugger] App detected: ${versionStr}${parsed.architecture} arch, ${parsed.jsEngine}, ${parsed.appPlatform} ${parsed.osVersion}`);
|
|
40
65
|
}
|
|
41
66
|
}
|
|
42
67
|
}
|
|
@@ -81,7 +106,7 @@ function detectApp(ws) {
|
|
|
81
106
|
params: {
|
|
82
107
|
expression: DETECTION_EXPRESSION,
|
|
83
108
|
returnByValue: true,
|
|
84
|
-
awaitPromise:
|
|
109
|
+
awaitPromise: true,
|
|
85
110
|
userGesture: true,
|
|
86
111
|
generatePreview: false,
|
|
87
112
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appDetection.js","sourceRoot":"","sources":["../../src/core/appDetection.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAM,oBAAoB,GAAG,
|
|
1
|
+
{"version":3,"file":"appDetection.js","sourceRoot":"","sources":["../../src/core/appDetection.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,2EAA2E;AAC3E,kFAAkF;AAClF,wCAAwC;AACxC,iEAAiE;AACjE,4DAA4D;AAC5D,sFAAsF;AACtF,6DAA6D;AAC7D,+DAA+D;AAC/D,MAAM,oBAAoB,GAAG;;;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