react-native-ai-debugger 1.0.26 → 1.0.27
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 +166 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ An MCP (Model Context Protocol) server for AI-powered React Native debugging. En
|
|
|
6
6
|
|
|
7
7
|
- Captures `console.log`, `console.warn`, `console.error` from React Native apps
|
|
8
8
|
- **Network request tracking** - capture HTTP requests/responses with headers, timing, and status
|
|
9
|
+
- **React component inspection** - inspect component tree, props, state/hooks, and layout styles at runtime
|
|
9
10
|
- **Debug Web Dashboard** - browser-based UI to view logs and network requests in real-time
|
|
10
11
|
- Supports both **Expo SDK 54+** (React Native Bridgeless) and **RN 0.70+** (Hermes)
|
|
11
12
|
- **Auto-connect on startup** - automatically scans and connects to Metro when the server starts
|
|
@@ -136,6 +137,15 @@ Requires VS Code 1.102+ with Copilot ([docs](https://code.visualstudio.com/docs/
|
|
|
136
137
|
| `reload_app` | Reload the app (auto-connects if needed). Use sparingly - Fast Refresh handles most changes |
|
|
137
138
|
| `get_debug_server` | Get the debug HTTP server URL for browser-based viewing |
|
|
138
139
|
|
|
140
|
+
### React Component Inspection
|
|
141
|
+
|
|
142
|
+
| Tool | Description |
|
|
143
|
+
| -------------------- | ------------------------------------------------------------------- |
|
|
144
|
+
| `get_component_tree` | Get React component hierarchy from the running app (TONL format by default) |
|
|
145
|
+
| `get_screen_layout` | Get all components with layout styles (padding, margin, flex, etc.) |
|
|
146
|
+
| `inspect_component` | Inspect a specific component's props, state/hooks, and children |
|
|
147
|
+
| `find_components` | Find components matching a regex pattern with paths and layout info |
|
|
148
|
+
|
|
139
149
|
### Android (ADB)
|
|
140
150
|
|
|
141
151
|
| Tool | Description |
|
|
@@ -540,6 +550,162 @@ execute_in_app with expression="AsyncStorage.getItem('userToken')"
|
|
|
540
550
|
|
|
541
551
|
Set `awaitPromise=false` for synchronous execution only.
|
|
542
552
|
|
|
553
|
+
## React Component Inspection
|
|
554
|
+
|
|
555
|
+
Inspect React components at runtime via the React DevTools hook. These tools let you debug component state, verify layouts, and understand app structure without adding console.logs.
|
|
556
|
+
|
|
557
|
+
### Get Component Tree
|
|
558
|
+
|
|
559
|
+
View the React component hierarchy:
|
|
560
|
+
|
|
561
|
+
```
|
|
562
|
+
get_component_tree
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
Output (TONL format by default, ~50% smaller than JSON):
|
|
566
|
+
|
|
567
|
+
```
|
|
568
|
+
App
|
|
569
|
+
ErrorBoundary
|
|
570
|
+
SafeAreaProvider
|
|
571
|
+
Provider
|
|
572
|
+
HomeScreen
|
|
573
|
+
Header
|
|
574
|
+
FlatList
|
|
575
|
+
Footer
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
Options:
|
|
579
|
+
- `hideInternals=false` - Show internal RN components (RCTView, RNS*, etc.)
|
|
580
|
+
- `includeProps=true` - Include component props
|
|
581
|
+
- `format="json"` - Get structured JSON instead of TONL
|
|
582
|
+
|
|
583
|
+
### Find Components by Pattern
|
|
584
|
+
|
|
585
|
+
Search for components matching a regex:
|
|
586
|
+
|
|
587
|
+
```
|
|
588
|
+
find_components with pattern="Screen$"
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
Output:
|
|
592
|
+
|
|
593
|
+
```
|
|
594
|
+
pattern: Screen$
|
|
595
|
+
found: 5
|
|
596
|
+
#found{component,path,depth,key,layout}
|
|
597
|
+
HomeScreen|... > Navigator > HomeScreen|45||
|
|
598
|
+
SettingsScreen|... > Navigator > SettingsScreen|45||
|
|
599
|
+
ProfileScreen|... > Navigator > ProfileScreen|45||
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
Options:
|
|
603
|
+
- `summary=true` - Get counts only (e.g., "HomeScreen: 1, SettingsScreen: 1")
|
|
604
|
+
- `includeLayout=true` - Include flex, padding, margin values
|
|
605
|
+
- `maxResults=10` - Limit number of results
|
|
606
|
+
|
|
607
|
+
### Inspect Component State
|
|
608
|
+
|
|
609
|
+
Debug a specific component's props and hooks:
|
|
610
|
+
|
|
611
|
+
```
|
|
612
|
+
inspect_component with componentName="HomeScreen"
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
Output:
|
|
616
|
+
|
|
617
|
+
```json
|
|
618
|
+
{
|
|
619
|
+
"component": "HomeScreen",
|
|
620
|
+
"path": "... > Navigator > HomeScreen",
|
|
621
|
+
"props": {
|
|
622
|
+
"navigation": "[Object]",
|
|
623
|
+
"route": { "name": "Home", "key": "home-xyz" }
|
|
624
|
+
},
|
|
625
|
+
"hooks": [
|
|
626
|
+
{ "hookIndex": 0, "value": false },
|
|
627
|
+
{ "hookIndex": 1, "value": { "current": null } },
|
|
628
|
+
{ "hookIndex": 3, "value": 42 }
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
Options:
|
|
634
|
+
- `includeChildren=true` - List direct children component names
|
|
635
|
+
- `includeState=false` - Skip hooks/state (faster)
|
|
636
|
+
- `index=1` - Inspect 2nd instance if multiple exist
|
|
637
|
+
|
|
638
|
+
### Get Screen Layout
|
|
639
|
+
|
|
640
|
+
View all components with their layout styles:
|
|
641
|
+
|
|
642
|
+
```
|
|
643
|
+
get_screen_layout with summary=true
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
Output:
|
|
647
|
+
|
|
648
|
+
```
|
|
649
|
+
#summary total=320
|
|
650
|
+
View:83
|
|
651
|
+
RCTView:65
|
|
652
|
+
TouchableOpacity:12
|
|
653
|
+
Text:8
|
|
654
|
+
HomeScreen:1
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Full layout mode (`summary=false`):
|
|
658
|
+
|
|
659
|
+
```
|
|
660
|
+
#elements{component,path,depth,layout,id}
|
|
661
|
+
View|... > HomeScreen > View|46|flex:1|
|
|
662
|
+
Header|... > View > Header|47|height:60;padding:16|header
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
### Use Cases
|
|
666
|
+
|
|
667
|
+
**Debug Navigation Issues**
|
|
668
|
+
```
|
|
669
|
+
# Find which screen is currently mounted
|
|
670
|
+
find_components with pattern="Screen$"
|
|
671
|
+
|
|
672
|
+
# Check if a screen rendered multiple times (memory leak)
|
|
673
|
+
find_components with pattern="HomeScreen" summary=true
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
**Debug State Without console.log**
|
|
677
|
+
```
|
|
678
|
+
# Check current hook values
|
|
679
|
+
inspect_component with componentName="LoginForm"
|
|
680
|
+
# → hookIndex 2: false (isLoading)
|
|
681
|
+
# → hookIndex 3: "" (errorMessage)
|
|
682
|
+
|
|
683
|
+
# After user action, check if state changed
|
|
684
|
+
inspect_component with componentName="LoginForm"
|
|
685
|
+
# → hookIndex 2: true (isLoading changed!)
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
**Verify Layout Styles**
|
|
689
|
+
```
|
|
690
|
+
# Check if padding was applied correctly
|
|
691
|
+
get_screen_layout with componentsOnly=true
|
|
692
|
+
|
|
693
|
+
# Find components with specific layout issues
|
|
694
|
+
find_components with pattern="Card" includeLayout=true
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
**Understand Unfamiliar Codebase**
|
|
698
|
+
```
|
|
699
|
+
# Get app structure overview
|
|
700
|
+
get_component_tree with maxDepth=10
|
|
701
|
+
|
|
702
|
+
# Find all button variants
|
|
703
|
+
find_components with pattern="Button"
|
|
704
|
+
|
|
705
|
+
# Find all context providers
|
|
706
|
+
find_components with pattern="Provider$"
|
|
707
|
+
```
|
|
708
|
+
|
|
543
709
|
## Device Interaction
|
|
544
710
|
|
|
545
711
|
### Android (requires ADB)
|