agent-react-devtools 0.0.0 → 0.1.1-canary-20260210005551

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 ADDED
@@ -0,0 +1,40 @@
1
+ # agent-react-devtools
2
+
3
+ ## 0.1.1-canary-20260210005551
4
+
5
+ ### Patch Changes
6
+
7
+ - 10ac53c: Add comprehensive README with usage examples and MIT LICENSE file
8
+
9
+ ## 0.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d1e02f9: **Daemon, DevTools bridge, and component tree**
14
+
15
+ **Daemon** — Persistent background process with IPC server (Unix socket) that manages connections and dispatches commands.
16
+
17
+ **DevTools Bridge** — WebSocket server implementing the React DevTools "Wall" protocol. Connects to running React apps via `react-devtools-core`.
18
+
19
+ **Component Tree** — Parse and inspect the full React component hierarchy:
20
+
21
+ - View component tree with types, keys, and parent/child relationships
22
+ - Inspect props, state, and hooks of any component
23
+ - Search components by display name (fuzzy or exact match)
24
+ - Count components by type
25
+
26
+ **CLI** — Command-line interface with commands: `start`, `stop`, `status`, `tree`, `find`, `count`, `get component`.
27
+
28
+ **Formatting** — Token-efficient output designed for LLM consumption.
29
+
30
+ - 626a21a: **Profiler**
31
+
32
+ Start and stop profiling sessions to capture render performance data from connected React apps.
33
+
34
+ - **Render reports** — Per-component render duration and count
35
+ - **Slowest components** — Ranked by self render time
36
+ - **Most re-rendered** — Ranked by render count
37
+ - **Commit timeline** — Chronological view of React commits with durations
38
+ - **Commit details** — Per-component breakdown for a specific commit, sorted by self time
39
+
40
+ CLI commands: `profile start`, `profile stop`, `profile report`, `profile slow`, `profile rerenders`, `profile timeline`, `profile commit`.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # agent-react-devtools
2
+
3
+ Give your AI agent eyes into your React app. Inspect component trees, read props and state, and profile rendering performance — all from the command line. Inspired by Vercel's [agent-browser](https://github.com/vercel-labs/agent-browser) and Callstack's [agent-device](https://github.com/callstackincubator/agent-device).
4
+
5
+ The project is in early development and considered experimental. Pull requests are welcome!
6
+
7
+ ## Features
8
+
9
+ - Walk the full component tree with props, state, and hooks
10
+ - Search for components by display name
11
+ - Profile renders: find slow components, excessive re-renders, and commit timelines
12
+ - Persistent background daemon that survives across CLI calls
13
+ - Token-efficient output built for LLM consumption
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ npm install -g agent-react-devtools
19
+ ```
20
+
21
+ Or run it directly:
22
+
23
+ ```sh
24
+ npx agent-react-devtools start
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```sh
30
+ agent-react-devtools start
31
+ agent-react-devtools status
32
+ ```
33
+
34
+ ```
35
+ Daemon: running (port 8097)
36
+ Apps: 1 connected, 24 components
37
+ Uptime: 12s
38
+ ```
39
+
40
+ Browse the component tree:
41
+
42
+ ```sh
43
+ agent-react-devtools get tree --depth 3
44
+ ```
45
+
46
+ ```
47
+ @c1 [fn] "App"
48
+ ├─ @c2 [fn] "Header"
49
+ │ ├─ @c3 [fn] "Nav"
50
+ │ └─ @c4 [fn] "SearchBar"
51
+ ├─ @c5 [fn] "TodoList"
52
+ │ ├─ @c6 [fn] "TodoItem" key="1"
53
+ │ ├─ @c7 [fn] "TodoItem" key="2"
54
+ │ └─ @c8 [fn] "TodoItem" key="3"
55
+ └─ @c9 [fn] "Footer"
56
+ ```
57
+
58
+ Inspect a component's props, state, and hooks:
59
+
60
+ ```sh
61
+ agent-react-devtools get component @c6
62
+ ```
63
+
64
+ ```
65
+ @c6 [fn] "TodoItem" key="1"
66
+ props:
67
+ id: 1
68
+ text: "Buy groceries"
69
+ done: false
70
+ onToggle: ƒ
71
+ hooks:
72
+ State: false
73
+ Callback: ƒ
74
+ ```
75
+
76
+ Find components by name:
77
+
78
+ ```sh
79
+ agent-react-devtools find TodoItem
80
+ ```
81
+
82
+ ```
83
+ @c6 [fn] "TodoItem" key="1"
84
+ @c7 [fn] "TodoItem" key="2"
85
+ @c8 [fn] "TodoItem" key="3"
86
+ ```
87
+
88
+ Profile rendering performance:
89
+
90
+ ```sh
91
+ agent-react-devtools profile start
92
+ # ... interact with the app ...
93
+ agent-react-devtools profile stop
94
+ agent-react-devtools profile slow
95
+ ```
96
+
97
+ ```
98
+ Slowest (by avg render time):
99
+ TodoList avg:4.2ms max:8.1ms renders:6 cause:props
100
+ SearchBar avg:2.1ms max:3.4ms renders:12 cause:hooks
101
+ Header avg:0.8ms max:1.2ms renders:3 cause:parent
102
+ ```
103
+
104
+ ## Commands
105
+
106
+ ### Daemon
107
+
108
+ ```sh
109
+ agent-react-devtools start [--port 8097] # Start daemon
110
+ agent-react-devtools stop # Stop daemon
111
+ agent-react-devtools status # Connection status
112
+ ```
113
+
114
+ ### Components
115
+
116
+ ```sh
117
+ agent-react-devtools get tree [--depth N] # Component hierarchy
118
+ agent-react-devtools get component <@c1 | id> # Props, state, hooks
119
+ agent-react-devtools find <name> [--exact] # Search by display name
120
+ agent-react-devtools count # Component count by type
121
+ ```
122
+
123
+ Components are labeled `@c1`, `@c2`, etc. You can use these labels or numeric IDs interchangeably.
124
+
125
+ ### Profiling
126
+
127
+ ```sh
128
+ agent-react-devtools profile start [name] # Begin a profiling session
129
+ agent-react-devtools profile stop # Stop and collect data
130
+ agent-react-devtools profile report <@c1 | id> # Render report for a component
131
+ agent-react-devtools profile slow [--limit N] # Slowest components by avg duration
132
+ agent-react-devtools profile rerenders [--limit N] # Most re-rendered components
133
+ agent-react-devtools profile timeline [--limit N] # Commit timeline
134
+ agent-react-devtools profile commit <N | #N> [--limit N] # Single commit detail
135
+ ```
136
+
137
+ ## Connecting Your App
138
+
139
+ Install `react-devtools-core` in your app and connect before React renders (e.g. in `src/main.tsx`):
140
+
141
+ ```ts
142
+ import { initialize, connectToDevTools } from 'react-devtools-core';
143
+ import { createRoot } from 'react-dom/client';
144
+ import App from './App';
145
+
146
+ initialize();
147
+ connectToDevTools({ port: 8097 });
148
+
149
+ createRoot(document.getElementById('root')!).render(<App />);
150
+ ```
151
+
152
+ ## Using with AI Agents
153
+
154
+ Add something like this to your project's `CLAUDE.md` (or equivalent agent instructions):
155
+
156
+ ```markdown
157
+ ## React Debugging
158
+
159
+ This project uses agent-react-devtools to inspect the running React app.
160
+
161
+ - `agent-react-devtools start` — start the daemon
162
+ - `agent-react-devtools status` — check if the app is connected
163
+ - `agent-react-devtools get tree` — see the component hierarchy
164
+ - `agent-react-devtools get component @c1` — inspect a specific component
165
+ - `agent-react-devtools find <Name>` — search for components
166
+ - `agent-react-devtools profile start` / `profile stop` / `profile slow` — diagnose render performance
167
+ ```
168
+
169
+ ## Development
170
+
171
+ ```sh
172
+ bun install # Install dependencies
173
+ bun run build # Build
174
+ bun run test # Run tests
175
+ bun run typecheck # Type check
176
+ ```
177
+
178
+ ## License
179
+
180
+ MIT