@presto1314w/vite-devtools-browser 0.3.0 → 0.3.2

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
@@ -1,325 +1,320 @@
1
- # vite-browser
2
-
3
- `vite-browser` is a runtime diagnostics toolchain for Vite applications.
4
-
5
- It gives agents and developers structured access to:
6
-
7
- - Vue, React, and Svelte runtime state
8
- - Vite HMR activity and runtime health
9
- - event-window correlation between current errors and recent hot updates
10
- - early propagation diagnostics from store/module updates into rerender paths
11
- - rule-based HMR diagnosis with confidence levels
12
- - module graph snapshots and diffs
13
- - mapped error output with optional source snippets
14
- - network, logs, screenshots, and page evaluation
15
-
16
- It ships in two forms:
17
-
18
- - Agent Skill: scenario-based debugging workflows for coding assistants
19
- - CLI Runtime (`@presto1314w/vite-devtools-browser`): structured shell commands for local Vite debugging
20
-
21
- Current documented baseline: `v0.3.0`.
22
-
23
- ## What's New In v0.3
24
-
25
- `v0.3.0` is the propagation-diagnostics release.
26
-
27
- It keeps the `v0.2.x` runtime diagnosis model, then adds a new layer of propagation-oriented reasoning:
28
-
29
- - `correlate renders` summarizes recent render/update propagation evidence
30
- - `diagnose propagation` turns store/module/render/error signals into structured guidance
31
- - Vue-first store updates now include top-level `changedKeys`
32
- - browser-side collection now captures render and store-update signals as first-class events
33
- - propagation output stays conservative when evidence is incomplete
34
-
35
- ## Built For Agents
36
-
37
- `vite-browser` is designed for agent workflows as much as local debugging.
38
-
39
- Models do not work well with a DevTools panel that has to be visually inspected step by step. They work much better when runtime signals are exposed as structured commands that can be queried, compared, and chained in a loop. `vite-browser` turns framework state, Vite runtime status, HMR activity, module graph changes, mapped errors, logs, and network activity into terminal output that an agent can actually reason about.
40
-
41
- Under the hood, each command is a one-shot request against a long-lived browser daemon. That keeps the CLI simple for users while letting agent loops inspect a running app repeatedly without having to manage browser lifecycle on every step.
42
-
43
- ## Why vite-browser
44
-
45
- Most browser CLIs are optimized for automation. Most framework devtools are optimized for humans in a GUI.
46
-
47
- `vite-browser` is optimized for structured Vite runtime debugging:
48
-
49
- - it can inspect framework state like a devtools bridge
50
- - it can explain Vite-specific behavior like HMR updates and module graph changes
51
- - it can correlate recent updates with current failures
52
- - it can surface high-confidence clues about how store/module changes propagate into rerender paths
53
- - it returns structured text that AI agents can consume directly in loops
54
-
55
- ## Positioning
56
-
57
- | Tool | Best for | Notable gap compared with `vite-browser` |
58
- | --- | --- | --- |
59
- | `agent-browser` | general browser automation | not focused on Vite runtime diagnostics |
60
- | `next-browser` | Next.js + React debugging | not designed as a Vite runtime tool |
61
- | `vite-plugin-vue-mcp` | Vue MCP integration inside Vite | plugin/MCP-first, not a standalone diagnostics CLI |
62
- | `vite-browser` | Vite runtime diagnostics for agents and developers | browser lifecycle coverage still being expanded |
63
-
64
- ## Install
65
-
66
- ### Install Skill
67
-
68
- ```bash
69
- npx skills add MapleCity1314/vite-browser
70
- ```
71
-
72
- ### Install CLI
73
-
74
- ```bash
75
- npm install -g @presto1314w/vite-devtools-browser
76
- npx playwright install chromium
77
- ```
78
-
79
- ## Quick Start
80
-
81
- ```bash
82
- # terminal A: start Vite app
83
- cd my-app
84
- npm run dev
85
-
86
- # terminal B: inspect runtime
87
- vite-browser open http://localhost:5173
88
- vite-browser detect
89
- vite-browser vite runtime
90
- vite-browser errors --mapped --inline-source
91
- vite-browser correlate errors --mapped --window 5000
92
- vite-browser correlate renders --window 5000
93
- vite-browser diagnose propagation --window 5000
94
- vite-browser diagnose hmr --limit 50
95
- vite-browser vite hmr trace --limit 20
96
- vite-browser vite module-graph trace --limit 50
97
- vite-browser network
98
- vite-browser close
99
- ```
100
-
101
- For component/state debugging, then branch into framework-specific commands:
102
-
103
- ```bash
104
- vite-browser vue tree
105
- vite-browser vue pinia
106
- vite-browser vue router
107
- vite-browser react tree
108
- vite-browser svelte tree
109
- ```
110
-
111
- ## What It Looks Like
112
-
113
- ```bash
114
- $ vite-browser vite runtime
115
- # Vite Runtime
116
- URL: http://localhost:5173/
117
- Framework: vue
118
- Vite Client: loaded
119
- HMR Socket: open
120
- Error Overlay: none
121
- Tracked HMR Events: 3
122
-
123
- $ vite-browser vite hmr trace --limit 5
124
- # HMR Trace
125
- [12:34:10] connected [vite] connected.
126
- [12:34:15] update /src/App.vue
127
-
128
- $ vite-browser errors --mapped --inline-source
129
- Failed to resolve import "./missing"
130
-
131
- # Mapped Stack
132
- - http://localhost:5173/src/main.ts:12:4 -> /src/main.ts:12:4
133
- 12 | import "./missing"
134
-
135
- $ vite-browser correlate errors --mapped --window 5000
136
- # Error Correlation
137
- ## Current Error
138
- TypeError: boom at /src/App.tsx:4:2
139
-
140
- ## Correlation
141
- Confidence: high
142
- HMR update observed within 5000ms of the current error
143
- Matching modules: /src/App.tsx
144
-
145
- $ vite-browser correlate renders --window 5000
146
- # Render Correlation
147
- Confidence: high
148
- Recent source/store updates likely propagated through 1 render step(s).
149
-
150
- ## Store Updates
151
- - cart
152
-
153
- ## Changed Keys
154
- - items
155
-
156
- ## Render Path
157
- - AppShell > ShoppingCart > CartSummary
158
-
159
- $ vite-browser diagnose propagation --window 5000
160
- # Propagation Diagnosis
161
- Status: fail
162
- Confidence: high
163
- A plausible store -> render -> error propagation path was found.
164
-
165
- $ vite-browser diagnose hmr --limit 50
166
- # HMR Diagnosis
167
- ## missing-module
168
- Status: fail
169
- Confidence: high
170
- A module import failed to resolve during HMR.
171
- Suggestion: Verify the import path, file extension, alias configuration, and whether the module exists on disk.
172
- ```
173
-
174
- ## Core Capabilities
175
-
176
- - Framework detection: Vue/React/Svelte best-effort detection and version hinting
177
- - Vue runtime inspection: component tree/details, Pinia stores/getters, Vue Router state
178
- - React runtime inspection: component tree/details (props/state/hooks/context/source)
179
- - Svelte runtime inspection: component tree/details when metadata is available
180
- - Vite runtime diagnostics:
181
- - runtime status summary
182
- - HMR summary/timeline/clear
183
- - module-graph snapshot/diff/clear
184
- - error/HMR correlation over recent event windows
185
- - render/store propagation correlation over recent event windows
186
- - early propagation diagnosis with store updates, changed keys, and render paths
187
- - rule-based HMR diagnosis with confidence levels
188
- - source-mapped errors with optional inline source snippet
189
- - Debug utilities: console logs, network tracing, screenshot, page `eval`
190
-
191
- ## Recommended Workflows
192
-
193
- ### Runtime/HMR triage
194
-
195
- ```bash
196
- vite-browser vite runtime
197
- vite-browser errors --mapped --inline-source
198
- vite-browser correlate errors --mapped --window 5000
199
- vite-browser correlate renders --window 5000
200
- vite-browser diagnose propagation --window 5000
201
- vite-browser diagnose hmr --limit 50
202
- vite-browser vite hmr trace --limit 50
203
- vite-browser vite module-graph trace --limit 200
204
- ```
205
-
206
- ### Data/API triage
207
-
208
- ```bash
209
- vite-browser errors --mapped
210
- vite-browser logs
211
- vite-browser network
212
- vite-browser network <idx>
213
- vite-browser eval '<state probe>'
214
- ```
215
-
216
- ### Component/state triage
217
-
218
- ```bash
219
- vite-browser detect
220
- vite-browser vue tree
221
- vite-browser vue pinia
222
- vite-browser vue router
223
- vite-browser react tree
224
- vite-browser svelte tree
225
- ```
226
-
227
- ## Current Boundaries
228
-
229
- `vite-browser` v0.3.0 is strong at:
230
-
1
+ # vite-browser
2
+
3
+ **Explain why your Vite app broke after a hot update.**
4
+
5
+ `vite-browser` is a runtime diagnostics toolchain for Vite apps. It connects current errors to recent HMR activity, traces store and module updates into rerender paths, and returns structured terminal output that both developers and AI agents can reason about directly.
6
+
7
+ No plugin installation. No GUI. Just connect to a running Vite dev server and start querying.
8
+
9
+ **CLI**
10
+ ```bash
11
+ npm install -g @presto1314w/vite-devtools-browser
12
+ npx playwright install chromium
13
+ ```
14
+
15
+ **Agent Skill**
16
+ ```bash
17
+ npx skills add MapleCity1314/vite-browser
18
+ ```
19
+
20
+ ---
21
+
22
+ ## The Problem It Solves
23
+
24
+ You save a file. Vite hot-updates. The page breaks.
25
+
26
+ The error overlay tells you *what* broke. It does not tell you *why the update caused it*.
27
+
28
+ You want to know:
29
+ - which module change triggered this error
30
+ - whether a store update propagated into a broken render path
31
+ - what the HMR timeline looked like before the failure
32
+
33
+ `vite-browser` answers these questions from the terminal, without touching your project config.
34
+
35
+ ---
36
+
37
+ ## Quickstart
38
+
39
+ ```bash
40
+ # terminal A - your app
41
+ cd my-app && npm run dev
42
+
43
+ # terminal B - diagnostics
44
+ vite-browser open http://localhost:5173
45
+ vite-browser vite runtime
46
+ vite-browser errors --mapped --inline-source
47
+ vite-browser correlate errors --mapped --window 5000
48
+ vite-browser close
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Example: Tracing a Broken HMR Update
54
+
55
+ You edit `src/store/cart.ts`. The page breaks with `TypeError: cannot read properties of undefined`.
56
+
57
+ ```bash
58
+ # 1. check what the error actually is
59
+ $ vite-browser errors --mapped --inline-source
60
+
61
+ TypeError: Cannot read properties of undefined (reading 'items')
62
+
63
+ # Mapped Stack
64
+ - /src/components/CartSummary.tsx:14:12
65
+ 14 | total = cart.items.reduce(...)
66
+ ```
67
+
68
+ ```bash
69
+ # 2. correlate with recent HMR activity
70
+ $ vite-browser correlate errors --mapped --window 5000
71
+
72
+ # Error Correlation
73
+ Confidence: high
74
+ HMR update observed within 5000ms of the current error
75
+ Matching modules: /src/store/cart.ts
76
+ ```
77
+
78
+ ```bash
79
+ # 3. trace how the update propagated
80
+ $ vite-browser correlate renders --window 5000
81
+
82
+ # Render Correlation
83
+ Confidence: high
84
+ Recent store update likely propagated through 1 render step(s).
85
+
86
+ ## Store Updates
87
+ - cart
88
+
89
+ ## Changed Keys
90
+ - items
91
+
92
+ ## Render Path
93
+ - AppShell > ShoppingCart > CartSummary
94
+ ```
95
+
96
+ ```bash
97
+ # 4. get a structured diagnosis
98
+ $ vite-browser diagnose propagation --window 5000
99
+
100
+ # Propagation Diagnosis
101
+ Status: fail
102
+ Confidence: high
103
+ A plausible store -> render -> error propagation path was found.
104
+ ```
105
+
106
+ Four commands. You know the store update broke the render path. You know where to fix it.
107
+
108
+ ---
109
+
110
+ ## Built For Agents
111
+
112
+ Models cannot visually inspect a DevTools panel. They work much better when runtime signals are structured commands that can be queried, compared, and chained in a loop.
113
+
114
+ `vite-browser` turns Vite runtime state, HMR activity, module graph changes, framework component trees, mapped errors, and network activity into terminal output an agent can consume directly.
115
+
116
+ Each command is a one-shot request against a long-lived browser daemon - no browser lifecycle management on every step, no GUI dependency, no project config changes required.
117
+
118
+ ```bash
119
+ # an agent debugging loop looks like this
120
+ vite-browser vite runtime
121
+ vite-browser errors --mapped --inline-source
122
+ vite-browser correlate errors --mapped --window 5000
123
+ vite-browser correlate renders --window 5000
124
+ vite-browser diagnose propagation --window 5000
125
+ vite-browser diagnose hmr --limit 50
126
+ ```
127
+
128
+ Agent Skill workflows are also available for scenario-based debugging in coding assistants:
129
+
130
+ ```bash
131
+ npx skills add MapleCity1314/vite-browser
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Core Capabilities
137
+
138
+ **Framework detection**
139
+ - Vue, React, Svelte best-effort detection with version hinting
140
+
141
+ **Vue runtime**
142
+ - component tree and details
143
+ - Pinia stores, getters, and changed keys
144
+ - Vue Router state
145
+
146
+ **React runtime**
147
+ - component tree with props, state, hooks, context, and source metadata
148
+
149
+ **Svelte runtime**
150
+ - component tree when metadata is available
151
+
152
+ **Vite runtime diagnostics**
153
+ - runtime status and HMR health
154
+ - HMR timeline, summary, and clear
155
+ - module graph snapshot, diff, trace, and clear
156
+ - error / HMR correlation over configurable time windows
157
+ - store and module update / render path correlation
158
+ - propagation diagnosis with store updates, changed keys, and render paths
159
+ - rule-based HMR diagnosis with confidence levels
160
+ - source-mapped errors with optional inline source snippets
161
+
162
+ **Debug utilities**
163
+ - console logs, network tracing, screenshot, page `eval`
164
+
165
+ ---
166
+
167
+ ## Positioning
168
+
169
+ | Tool | Best for | Gap vs `vite-browser` |
170
+ |---|---|---|
171
+ | `agent-browser` | general browser automation | no Vite runtime awareness |
172
+ | `next-browser` | Next.js + React debugging | not a Vite runtime tool |
173
+ | `vite-plugin-vue-mcp` | Vue MCP integration | requires plugin install, Vue only |
174
+ | `vite-browser` | Vite runtime diagnostics for agents and developers | browser lifecycle coverage still expanding |
175
+
176
+ `vite-browser` requires no changes to your project. It works against any running Vite dev server across Vue, React, and Svelte.
177
+
178
+ ---
179
+
180
+ ## Recommended Workflows
181
+
182
+ ### HMR / runtime triage
183
+ ```bash
184
+ vite-browser vite runtime
185
+ vite-browser errors --mapped --inline-source
186
+ vite-browser correlate errors --mapped --window 5000
187
+ vite-browser diagnose hmr --limit 50
188
+ vite-browser vite hmr trace --limit 50
189
+ vite-browser vite module-graph trace --limit 200
190
+ ```
191
+
192
+ ### Propagation / rerender triage
193
+ ```bash
194
+ vite-browser correlate renders --window 5000
195
+ vite-browser diagnose propagation --window 5000
196
+ vite-browser vue pinia
197
+ vite-browser vue tree
198
+ ```
199
+
200
+ ### Data / API triage
201
+ ```bash
202
+ vite-browser errors --mapped
203
+ vite-browser logs
204
+ vite-browser network
205
+ vite-browser network <idx>
206
+ vite-browser eval '<state probe>'
207
+ ```
208
+
209
+ ### Component / state triage
210
+ ```bash
211
+ vite-browser detect
212
+ vite-browser vue tree
213
+ vite-browser vue pinia
214
+ vite-browser vue router
215
+ vite-browser react tree
216
+ vite-browser svelte tree
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Command Reference
222
+
223
+ ### Browser
224
+ ```bash
225
+ vite-browser open <url> [--cookies-json <file>]
226
+ vite-browser close
227
+ vite-browser goto <url>
228
+ vite-browser back
229
+ vite-browser reload
230
+ ```
231
+
232
+ ### Framework
233
+ ```bash
234
+ vite-browser detect
235
+ vite-browser vue tree [id]
236
+ vite-browser vue pinia [store]
237
+ vite-browser vue router
238
+ vite-browser react tree [id]
239
+ vite-browser svelte tree [id]
240
+ ```
241
+
242
+ ### Vite Runtime
243
+ ```bash
244
+ vite-browser vite restart
245
+ vite-browser vite runtime
246
+ vite-browser vite hmr
247
+ vite-browser vite hmr trace [--limit <n>]
248
+ vite-browser vite hmr clear
249
+ vite-browser vite module-graph [--filter <txt>] [--limit <n>]
250
+ vite-browser vite module-graph trace [--filter <txt>] [--limit <n>]
251
+ vite-browser vite module-graph clear
252
+ vite-browser errors
253
+ vite-browser errors --mapped
254
+ vite-browser errors --mapped --inline-source
255
+ vite-browser correlate errors [--window <ms>]
256
+ vite-browser correlate renders [--window <ms>]
257
+ vite-browser correlate errors --mapped --inline-source
258
+ vite-browser diagnose hmr [--window <ms>] [--limit <n>]
259
+ vite-browser diagnose propagation [--window <ms>]
260
+ ```
261
+
262
+ ### Utilities
263
+ ```bash
264
+ vite-browser logs
265
+ vite-browser network [idx]
266
+ vite-browser screenshot
267
+ vite-browser eval <script>
268
+ ```
269
+
270
+ ---
271
+
272
+ ## Current Boundaries
273
+
274
+ `v0.3.2` is strong at:
231
275
  - surfacing runtime state as structured shell output
232
- - linking current errors to recent HMR/module activity
233
- - detecting several common HMR failure patterns quickly
276
+ - linking current errors to recent HMR and module activity
277
+ - detecting common HMR failure patterns with confidence levels
234
278
  - narrowing likely store/module -> render paths in Vue-first flows
235
-
236
- `v0.3.0` is still not a full propagation-trace engine. Treat `correlate renders` and `diagnose propagation` as high-confidence propagation clues, not strict causal proof. In particular, they do not reliably infer deep chains like `store -> component A -> component B -> error` across arbitrary component graphs, and they intentionally fall back to conservative output when evidence is incomplete.
237
-
238
- ## Command Reference
239
-
240
- ### Browser
241
-
242
- ```bash
243
- vite-browser open <url> [--cookies-json <file>]
244
- vite-browser close
245
- vite-browser goto <url>
246
- vite-browser back
247
- vite-browser reload
248
- ```
249
-
250
- ### Framework
251
-
252
- ```bash
253
- vite-browser detect
254
- vite-browser vue tree [id]
255
- vite-browser vue pinia [store]
256
- vite-browser vue router
257
- vite-browser react tree [id]
258
- vite-browser svelte tree [id]
259
- ```
260
-
261
- ### Vite Runtime
262
-
263
- ```bash
264
- vite-browser vite restart
265
- vite-browser vite runtime
266
- vite-browser vite hmr
267
- vite-browser vite hmr trace [--limit <n>]
268
- vite-browser vite hmr clear
269
- vite-browser vite module-graph [--filter <txt>] [--limit <n>]
270
- vite-browser vite module-graph trace [--filter <txt>] [--limit <n>]
271
- vite-browser vite module-graph clear
272
- vite-browser errors
273
- vite-browser errors --mapped
274
- vite-browser errors --mapped --inline-source
275
- vite-browser correlate errors [--window <ms>]
276
- vite-browser correlate renders [--window <ms>]
277
- vite-browser correlate errors --mapped --inline-source
278
- vite-browser diagnose hmr [--window <ms>] [--limit <n>]
279
- vite-browser diagnose propagation [--window <ms>]
280
- ```
281
-
282
- ### Utilities
283
-
284
- ```bash
285
- vite-browser logs
286
- vite-browser network [idx]
287
- vite-browser screenshot
288
- vite-browser eval <script>
289
- ```
290
-
291
- ## Skill Packs
292
-
293
- The entry skill routes to specialized workflows:
294
-
295
- - `skills/vite-browser-core-debug/SKILL.md`
296
- - `skills/vite-browser-runtime-diagnostics/SKILL.md`
297
- - `skills/vite-browser-network-regression/SKILL.md`
298
- - `skills/vite-browser-release-smoke/SKILL.md`
299
-
300
- Router definition: [skills/SKILL.md](./skills/SKILL.md)
301
-
302
- ## Local Development
303
-
304
- ```bash
305
- pnpm install
306
- pnpm build
307
- pnpm test
308
- pnpm test:coverage
309
- pnpm test:evals
310
- pnpm test:evals:e2e
311
- ```
312
-
313
- ## Discovery
314
-
315
- If you want to introduce the project to new users, start with the launch kit in [docs/launch-kit.md](./docs/launch-kit.md).
316
-
317
- ## Requirements
318
-
319
- - Node.js `>=20`
320
- - Chromium installed via Playwright
321
- - Running Vite dev server
322
-
323
- ## License
324
-
325
- MIT
279
+ - capturing browser-side runtime errors even when the Vite overlay is absent
280
+ - turning sparse live Vue/Pinia repro signals into actionable `store -> render -> error` guidance more reliably
281
+
282
+ `correlate renders` and `diagnose propagation` are **high-confidence propagation clues**, not strict causal proof. They do not reliably trace deep chains like `store -> component A -> component B -> error` across arbitrary graphs, and intentionally fall back to conservative output when evidence is incomplete.
283
+
284
+ React store inspection (Zustand, Redux) and deeper cross-framework propagation tracing are on the roadmap.
285
+
286
+ ---
287
+
288
+ ## Skill Packs
289
+
290
+ ```
291
+ skills/vite-browser-core-debug/SKILL.md
292
+ skills/vite-browser-runtime-diagnostics/SKILL.md
293
+ skills/vite-browser-network-regression/SKILL.md
294
+ skills/vite-browser-release-smoke/SKILL.md
295
+ ```
296
+
297
+ Router: [skills/SKILL.md](./skills/SKILL.md)
298
+
299
+ ---
300
+
301
+ ## Local Development
302
+
303
+ ```bash
304
+ pnpm install
305
+ pnpm build
306
+ pnpm test
307
+ pnpm test:coverage
308
+ pnpm test:evals
309
+ pnpm test:evals:e2e
310
+ ```
311
+
312
+ ## Requirements
313
+
314
+ - Node.js `>=20`
315
+ - Chromium via Playwright
316
+ - Running Vite dev server
317
+
318
+ ## License
319
+
320
+ MIT