browsertrack 0.2.0 → 0.2.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.
Files changed (67) hide show
  1. package/AGENTS.md +11 -6
  2. package/README.md +2 -0
  3. package/dist/{chunk-WB7ZKWK7.js → chunk-4HRLW6YF.js} +509 -109
  4. package/dist/chunk-4HRLW6YF.js.map +1 -0
  5. package/dist/{chunk-3HOXPTM2.js → chunk-AYSVE6NG.js} +808 -53
  6. package/dist/chunk-AYSVE6NG.js.map +1 -0
  7. package/dist/{chunk-6VA7GBAO.js → chunk-QRZ57ME3.js} +70 -2
  8. package/dist/chunk-QRZ57ME3.js.map +1 -0
  9. package/dist/{chunk-UP5JKCFY.js → chunk-TWEYRBDU.js} +281 -44
  10. package/dist/chunk-TWEYRBDU.js.map +1 -0
  11. package/dist/cli/index.js +1040 -546
  12. package/dist/cli/index.js.map +1 -1
  13. package/dist/client/index.cjs +536 -109
  14. package/dist/client/index.d.ts +36 -4
  15. package/dist/client/index.js +8 -4
  16. package/dist/client.iife.js +42 -19
  17. package/dist/{notes-BMnonq46.d.ts → commands-fjuqKzkm.d.ts} +125 -114
  18. package/dist/core/index.d.ts +26 -3
  19. package/dist/core/index.js +9 -1
  20. package/dist/daemon/index.d.ts +4 -4
  21. package/dist/daemon/index.js +6 -8
  22. package/dist/{engine-B43IohQY.d.ts → engine-CmchnMDq.d.ts} +2 -2
  23. package/dist/index.d.ts +5 -5
  24. package/dist/index.js +14 -7
  25. package/dist/mcp/index.d.ts +4 -4
  26. package/dist/mcp/index.js +7 -4
  27. package/dist/{projects-D5J-egVN.d.ts → projects-DB7S312i.d.ts} +1 -1
  28. package/dist/{server-BztYp1Zc.d.ts → server-DjV7RWQM.d.ts} +10 -2
  29. package/docs/cli.md +4 -1
  30. package/docs/component-resolver.md +108 -0
  31. package/docs/getting-started.md +60 -6
  32. package/docs/index.md +1 -0
  33. package/docs/mcp-reference.md +44 -2
  34. package/docs/visual-notes.md +36 -0
  35. package/package.json +1 -1
  36. package/packages/cli/src/index.ts +247 -151
  37. package/packages/client/src/client.ts +18 -1
  38. package/packages/client/src/config.ts +84 -1
  39. package/packages/client/src/index.ts +4 -1
  40. package/packages/client/src/interceptors/interaction.ts +3 -0
  41. package/packages/client/src/interceptors/navigation.ts +38 -26
  42. package/packages/client/src/interceptors/network.ts +22 -17
  43. package/packages/client/src/notes/inspector.ts +186 -51
  44. package/packages/client/src/source/resolver.ts +278 -0
  45. package/packages/client/src/transport/websocket.ts +23 -18
  46. package/packages/core/src/index.ts +1 -0
  47. package/packages/core/src/safety.ts +86 -0
  48. package/packages/core/src/types/events.ts +3 -0
  49. package/packages/core/src/types/notes.ts +11 -0
  50. package/packages/daemon/src/server/daemon.ts +7 -1
  51. package/packages/daemon/src/server/http.ts +125 -5
  52. package/packages/daemon/src/server/ws.ts +33 -29
  53. package/packages/daemon/src/storage/db.ts +57 -35
  54. package/packages/mcp/src/handlers.ts +115 -45
  55. package/packages/mcp/src/server.ts +202 -2
  56. package/test/client/component-resolver.test.ts +141 -0
  57. package/test/client/interceptors.test.ts +56 -0
  58. package/test/core/safety.test.ts +106 -0
  59. package/test/daemon/storage.test.ts +36 -0
  60. package/test/e2e/daemon-mcp-e2e.test.ts +10 -0
  61. package/test/mcp/auto-start.test.ts +87 -0
  62. package/dist/chunk-3HOXPTM2.js.map +0 -1
  63. package/dist/chunk-6VA7GBAO.js.map +0 -1
  64. package/dist/chunk-7OCOQGDN.js +0 -635
  65. package/dist/chunk-7OCOQGDN.js.map +0 -1
  66. package/dist/chunk-UP5JKCFY.js.map +0 -1
  67. package/dist/chunk-WB7ZKWK7.js.map +0 -1
package/AGENTS.md CHANGED
@@ -33,6 +33,7 @@ graph TD
33
33
 
34
34
  1. **Find open notes:** Call `list_notes({ status: "OPEN" })`.
35
35
  2. **Inspect note context:** Call `get_note({ noteId: "note_xxx" })`.
36
+ - **Check `elementContext.componentSource`**: In React, Vue, or Svelte apps, this gives you the exact component name, source file (`sourceFile`), and line number (`sourceLine`). Open that file directly!
36
37
  - Review the target selector (`target.selector`), viewport dimensions, bounding box (`boundingRect`), and screenshot path.
37
38
  - Check if layout overflow (`overflow-x`, min-width, flex wrapping) is causing the issue.
38
39
  3. **Apply the fix:** Edit the corresponding CSS, style rules, or component markup.
@@ -49,6 +50,7 @@ When an error or unexpected behavior occurs in the frontend:
49
50
  1. **List open incidents:** Call `list_incidents({ status: "OPEN" })`.
50
51
  2. **Retrieve incident details:** Call `get_incident({ incidentId: "inc_xxx" })`.
51
52
  - Inspect stack traces, exact source line/column, last user interactions, and failing network calls.
53
+ - **Check `lastInteractedElement.componentSource`** to see which React/Vue component and source file was clicked right before the crash.
52
54
  3. **Inspect interaction timeline (if needed):** Call `get_breadcrumbs({ incidentId: "inc_xxx" })` to see what clicks, inputs, or navigations led to the failure.
53
55
  4. **Inspect failed network requests (if needed):** Call `get_network_failures()` to examine 4xx/5xx status codes, request URLs, and response details.
54
56
  5. **Apply code fix:** Edit the source file causing the bug.
@@ -97,10 +99,9 @@ When an error or unexpected behavior occurs in the frontend:
97
99
 
98
100
  If BrowserTrack is not yet active in your project:
99
101
 
100
- ### 1. Ensure Daemon is Running
101
- ```bash
102
- browsertrack start
103
- ```
102
+ ### 1. Zero-Config Daemon Auto-Boot (Singleton Daemon)
103
+ You do **not** need to manually run `browsertrack start`! When your IDE connects to BrowserTrack via MCP (`browsertrack mcp`), the background HTTP/WebSocket server is launched **automatically** on `http://127.0.0.1:7331` as a **singleton daemon**. Multiple windows, workspaces, or sub-agent sessions seamlessly share this single daemon without spawning duplicates or conflicting on ports.
104
+ *(You can still manually run `browsertrack start` or `browsertrack stop` if you want a standalone terminal process).*
104
105
 
105
106
  ### 2. Connect the Browser Client
106
107
  - **Via HTML script tag:**
@@ -114,17 +115,21 @@ browsertrack start
114
115
 
115
116
  ### 3. MCP Configuration
116
117
  Ensure BrowserTrack MCP is configured in your editor:
118
+
117
119
  ```json
118
120
  {
119
121
  "mcpServers": {
120
122
  "browsertrack": {
121
- "command": "browsertrack",
122
- "args": ["mcp"]
123
+ "command": "npx",
124
+ "args": ["-y", "browsertrack@latest", "mcp"]
123
125
  }
124
126
  }
125
127
  }
126
128
  ```
127
129
 
130
+ > **Note on PATH errors (`executable file not found in $PATH`):**
131
+ > If your IDE cannot find `npx` or `browsertrack` in `$PATH` (common in GUI apps on macOS using NVM or Homebrew), provide the absolute path to `npx` (e.g. `~/.nvm/versions/node/v20.x.x/bin/npx`) along with `PATH` in the `env` object.
132
+
128
133
  ---
129
134
 
130
135
  ## 💡 Best Practices for AI Agents
package/README.md CHANGED
@@ -17,6 +17,8 @@ browsertrack start
17
17
 
18
18
  This starts the local diagnostics server at `http://127.0.0.1:7331` (WebSocket at `ws://127.0.0.1:7331`).
19
19
 
20
+ > **⚡ Zero-Config Auto-Start**: If you configure BrowserTrack via MCP in your AI editor (Cursor, Antigravity, Claude Code), you do **not** need to manually run `browsertrack start`! The MCP server automatically launches and manages a **single background daemon (singleton)** on port `7331`. Multiple windows or sessions share this single daemon without duplicate processes or port conflicts.
21
+
20
22
  ### 2. Connect Your Web Project
21
23
 
22
24
  #### Option A: Zero-install script tag (Plain HTML / Vite / Next.js)