browser-debugger-cli 0.1.0-alpha.1 → 0.1.0

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 (2) hide show
  1. package/README.md +58 -68
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -29,36 +29,68 @@ bdg status
29
29
  # Chrome PID: 67890
30
30
  # Target: http://example.com
31
31
 
32
- # Preview collected data
33
- bdg peek --last 5
34
- # NETWORK [0] GET http://example.com/ (200)
35
- # NETWORK [1] GET http://example.com/style.css (200)
36
- # ...
37
-
38
32
  # Execute raw CDP commands
39
33
  bdg cdp Runtime.evaluate --params '{"expression":"document.title","returnByValue":true}'
40
34
  # { "result": { "type": "string", "value": "Example Domain" } }
41
35
 
36
+ bdg cdp Network.getCookies
37
+ # { "cookies": [...] }
38
+
42
39
  # Stop session
43
40
  bdg stop
44
41
  ```
45
42
 
46
- ## Philosophy
43
+ ## How It Works
47
44
 
48
- There's no good CLI for Chrome DevTools Protocol. MCP servers work (most of the time) but are token-heavy and monolithic. Puppeteer is for automation, not inspection. Lighthouse is single-purpose.
45
+ `bdg` is built on a **layered architecture** — raw CDP access with human-friendly wrappers on top.
49
46
 
50
- `bdg` takes the Unix approach: small, composable commands that pipe with `jq` and `grep` tools models already know—without the token overhead.
47
+ ### Layer 1: Raw CDP Access ✅
51
48
 
52
- **Why CLI over protocol servers?**
53
- - **Token efficiency**: CDP is in the model's training data. A skill doc with usage
54
- patterns? ~3k tokens. MCP server definitions? 5-10k before you invoke anything.
55
- - **Composability**: Pipe commands together. Each does one thing well.
56
- - **Transparent errors**: See exactly what failed. No protocol layers hiding the
57
- issue.
58
- - **Real-time evolution**: Update usage patterns anytime. No server redeployment
59
- needed.
49
+ Direct access to **60+ domains, 300+ methods** from [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/):
50
+
51
+ ```bash
52
+ # Execute any CDP method
53
+ bdg cdp Network.getCookies
54
+ bdg cdp Runtime.evaluate --params '{"expression":"document.title","returnByValue":true}'
55
+ bdg cdp Performance.getMetrics
56
+
57
+ # Pipe to jq for filtering
58
+ bdg cdp Network.getCookies | jq '.cookies[] | select(.name == "session")'
59
+ ```
60
60
 
61
- The vision: Terminal-native browser debugging that's as composable as `curl` and `jq`.
61
+ **Why raw CDP first?**
62
+ - ✅ Zero abstraction overhead — direct WebSocket to Chrome
63
+ - ✅ Full protocol power — all CDP methods work immediately
64
+ - ✅ Future-proof — new CDP features work without code changes
65
+ - ✅ Agent-friendly — structured input/output, composable with Unix tools
66
+
67
+ ### Layer 2: Human-Friendly Wrappers 🚧
68
+
69
+ Building ergonomic commands on top of raw CDP for common workflows:
70
+
71
+ ```bash
72
+ # Session management
73
+ bdg status # Check active session
74
+ bdg stop # Stop session gracefully
75
+ bdg cleanup # Clean up stale sessions
76
+
77
+ # Data inspection
78
+ bdg peek # Quick preview of collected data
79
+ bdg peek --follow # Live updates every second
80
+ bdg details # Full details for specific items
81
+ bdg dom query # Query DOM elements
82
+ bdg dom eval # Execute JavaScript in browser context
83
+ bdg dom highlight # Highlight elements visually
84
+ bdg dom get # Get full HTML for elements
85
+ ```
86
+
87
+ **Progressive disclosure**: Start with raw CDP power, add convenience wrappers for common patterns.
88
+
89
+ **Why CLI over protocol servers?**
90
+ - **Token efficiency**: CDP is in the model's training data (~3k tokens for patterns vs. 5-10k for MCP server definitions)
91
+ - **Composability**: Unix pipes with `jq`, `grep`, `awk` — tools models already know
92
+ - **Transparent errors**: See exactly what failed, no protocol layers hiding issues
93
+ - **Real-time evolution**: Update patterns anytime, no server redeployment
62
94
 
63
95
  ## Available Commands
64
96
 
@@ -109,61 +141,19 @@ bdg cdp Network.getCookies | jq '.cookies[] | select(.name == "session_id") | .v
109
141
  ### Session Management
110
142
 
111
143
  ```bash
144
+ # Start session
145
+ bdg example.com # Opens Chrome with daemon in background
146
+
112
147
  # Check if session is active
113
- bdg status
114
- # Status: Active
115
- # Worker PID: 12345
116
- # Chrome PID: 67890
117
- # Target: http://example.com
148
+ bdg status # Show session info
149
+ bdg status --verbose # Include Chrome diagnostics
118
150
 
119
151
  # Stop session
120
- bdg stop
152
+ bdg stop # Gracefully stop daemon and close Chrome
121
153
 
122
154
  # Clean up stale sessions
123
- bdg cleanup
124
- bdg cleanup --force # Force cleanup even if session appears active
125
- ```
126
-
127
- ### Live Data Inspection
128
-
129
- ```bash
130
- # Preview collected data without stopping
131
- bdg peek
132
- bdg peek --last 10 # Show last 10 items
133
- bdg peek --network # Only network requests
134
- bdg peek --console # Only console logs
135
- bdg peek --follow # Live updates every second
136
- bdg peek --json # JSON output
137
-
138
- # Get detailed information
139
- bdg details network <requestId> # Full request/response with bodies
140
- bdg details console <index> # Full console message with args
141
- ```
142
-
143
- ### DOM Inspection
144
-
145
- ```bash
146
- # Query DOM elements
147
- bdg dom query "document.title"
148
- bdg dom query ".error-message"
149
-
150
- # Get element by selector or index
151
- bdg dom get ".main-content"
152
- bdg dom get 0 # Get first element from cache
153
-
154
- # Evaluate JavaScript
155
- bdg dom eval "window.location.href"
156
- ```
157
-
158
- ### Network & Console Commands
159
-
160
- ```bash
161
- # Inspect network state
162
- bdg network
163
-
164
- # Query console logs
165
- bdg console
166
- bdg console --json
155
+ bdg cleanup # Remove stale session files
156
+ bdg cleanup --force # Force cleanup even if session appears active
167
157
  ```
168
158
 
169
159
  ## Technical Overview
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "browser-debugger-cli",
3
- "version": "0.1.0-alpha.1",
4
- "description": "Browser telemetry via Chrome DevTools Protocol",
3
+ "version": "0.1.0",
4
+ "description": "DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "bdg": "dist/index.js"