opendevbrowser 0.0.10 → 0.0.12

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
@@ -4,7 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg?style=flat-square)](https://www.typescriptlang.org/)
6
6
  [![OpenCode Plugin](https://img.shields.io/badge/OpenCode-Plugin-green.svg?style=flat-square)](https://opencode.ai)
7
- [![Test Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg?style=flat-square)](https://github.com/freshtechbro/opendevbrowser)
7
+ [![Test Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg?style=flat-square)](https://registry.npmjs.org/opendevbrowser)
8
8
 
9
9
  > **Script-first browser automation for AI agents.** Snapshot → Refs → Actions.
10
10
 
@@ -40,6 +40,12 @@ Recommended (CLI, installs plugin + config + bundled skills + extension assets):
40
40
  npx opendevbrowser --full --global --no-prompt
41
41
  ```
42
42
 
43
+ Explicit flags (config + skills, no prompt):
44
+
45
+ ```bash
46
+ npx opendevbrowser --global --with-config --skills-global --no-prompt
47
+ ```
48
+
43
49
  Manual fallback (edit OpenCode config):
44
50
 
45
51
  ```json
@@ -77,6 +83,34 @@ Restart OpenCode, then run `opendevbrowser_status` to verify the plugin is loade
77
83
 
78
84
  ---
79
85
 
86
+ ### CLI Automation Quick Start
87
+
88
+ Run a local daemon for persistent sessions, then drive automation via CLI commands:
89
+
90
+ ```bash
91
+ # Start daemon
92
+ npx opendevbrowser serve
93
+
94
+ # Launch a session
95
+ npx opendevbrowser launch --start-url https://example.com
96
+
97
+ # Capture a snapshot
98
+ npx opendevbrowser snapshot --session-id <session-id>
99
+
100
+ # Interact by ref
101
+ npx opendevbrowser click --session-id <session-id> --ref r12
102
+ ```
103
+
104
+ For single-shot scripts:
105
+
106
+ ```bash
107
+ npx opendevbrowser run --script ./script.json --output-format json
108
+ ```
109
+
110
+ Use `--output-format json|stream-json` for automation-friendly output.
111
+
112
+ ---
113
+
80
114
  ## Features
81
115
 
82
116
  ### Browser Control
@@ -106,25 +140,159 @@ Restart OpenCode, then run `opendevbrowser_status` to verify the plugin is loade
106
140
 
107
141
  ---
108
142
 
143
+ ## Tool Reference
144
+
145
+ OpenDevBrowser provides **30 tools** organized by category:
146
+
147
+ ### Session Management
148
+ | Tool | Description |
149
+ |------|-------------|
150
+ | `opendevbrowser_launch` | Launch managed Chrome session with optional profile |
151
+ | `opendevbrowser_connect` | Connect to existing Chrome CDP endpoint |
152
+ | `opendevbrowser_disconnect` | Disconnect browser session |
153
+ | `opendevbrowser_status` | Get session status and connection info |
154
+
155
+ ### Tab/Target Management
156
+ | Tool | Description |
157
+ |------|-------------|
158
+ | `opendevbrowser_targets_list` | List all browser tabs/targets |
159
+ | `opendevbrowser_target_use` | Switch to a specific tab by targetId |
160
+ | `opendevbrowser_target_new` | Open new tab (optionally with URL) |
161
+ | `opendevbrowser_target_close` | Close a tab by targetId |
162
+
163
+ ### Named Pages
164
+ | Tool | Description |
165
+ |------|-------------|
166
+ | `opendevbrowser_page` | Open or focus a named page (logical tab alias) |
167
+ | `opendevbrowser_list` | List all named pages in session |
168
+ | `opendevbrowser_close` | Close a named page |
169
+
170
+ ### Navigation & Interaction
171
+ | Tool | Description |
172
+ |------|-------------|
173
+ | `opendevbrowser_goto` | Navigate to URL |
174
+ | `opendevbrowser_wait` | Wait for load state or element |
175
+ | `opendevbrowser_snapshot` | Capture page accessibility tree with refs |
176
+ | `opendevbrowser_click` | Click element by ref |
177
+ | `opendevbrowser_type` | Type text into input by ref |
178
+ | `opendevbrowser_select` | Select dropdown option by ref |
179
+ | `opendevbrowser_scroll` | Scroll page or element |
180
+ | `opendevbrowser_run` | Execute multiple actions in sequence |
181
+
182
+ ### DOM Inspection
183
+ | Tool | Description |
184
+ |------|-------------|
185
+ | `opendevbrowser_dom_get_html` | Get outerHTML of element by ref |
186
+ | `opendevbrowser_dom_get_text` | Get innerText of element by ref |
187
+
188
+ ### DevTools & Analysis
189
+ | Tool | Description |
190
+ |------|-------------|
191
+ | `opendevbrowser_console_poll` | Poll console logs since sequence |
192
+ | `opendevbrowser_network_poll` | Poll network requests since sequence |
193
+ | `opendevbrowser_screenshot` | Capture page screenshot |
194
+ | `opendevbrowser_perf` | Get page performance metrics |
195
+ | `opendevbrowser_prompting_guide` | Get best-practice prompting guidance |
196
+
197
+ ### Export & Cloning
198
+ | Tool | Description |
199
+ |------|-------------|
200
+ | `opendevbrowser_clone_page` | Export page as React component + CSS |
201
+ | `opendevbrowser_clone_component` | Export element subtree as React component |
202
+
203
+ ### Skills
204
+ | Tool | Description |
205
+ |------|-------------|
206
+ | `opendevbrowser_skill_list` | List available skills |
207
+ | `opendevbrowser_skill_load` | Load a skill by name (with optional topic filter) |
208
+
209
+ ---
210
+
211
+ ## Bundled Skills
212
+
213
+ OpenDevBrowser includes **5 task-specific skill packs**:
214
+
215
+ | Skill | Purpose |
216
+ |-------|---------|
217
+ | `opendevbrowser-best-practices` | Core prompting patterns and workflow guidance |
218
+ | `opendevbrowser-continuity-ledger` | Long-running task state management |
219
+ | `login-automation` | Authentication flow patterns |
220
+ | `form-testing` | Form validation and submission workflows |
221
+ | `data-extraction` | Structured data scraping patterns |
222
+
223
+ Skills are discovered from (priority order):
224
+ 1. `.opencode/skill/` (project)
225
+ 2. `~/.config/opencode/skill/` (global)
226
+ 3. `.claude/skills/` (compatibility)
227
+ 4. `~/.claude/skills/` (compatibility)
228
+ 5. Custom paths via `skillPaths` config
229
+
230
+ Load a skill: `opendevbrowser_skill_load` with `name` and optional `topic` filter.
231
+
232
+ ---
233
+
234
+ ## Browser Modes
235
+
236
+ | Mode | Tool | Use Case |
237
+ |------|------|----------|
238
+ | **Managed** | `opendevbrowser_launch` | Fresh browser, full control, automatic cleanup |
239
+ | **CDP Connect** | `opendevbrowser_connect` | Attach to existing Chrome with `--remote-debugging-port` |
240
+ | **Extension Relay** | Chrome Extension | Attach to logged-in tabs via relay server |
241
+
242
+ ---
243
+
109
244
  ## Chrome Extension (Optional)
110
245
 
111
246
  The extension enables **Mode C** - attach to existing logged-in browser tabs without launching a new browser.
112
247
 
113
- ### Auto-Pair Feature
248
+ ### Auto-Connect + Auto-Pair
114
249
 
115
250
  The plugin and extension can automatically pair:
116
251
 
117
- 1. **Plugin side**: Auto-generates secure token on first run (saved to config)
252
+ 1. **Plugin side**: Starts a local relay server and config discovery endpoint
118
253
  2. **Extension side**: Enable "Auto-Pair" toggle and click Connect
119
- 3. Extension fetches token from plugin's relay server
254
+ 3. Extension fetches relay port from discovery, then fetches token from the relay server
120
255
  4. Connection established with color indicator (green = connected)
121
256
 
257
+ **Auto-connect** and **Auto-pair** are enabled by default for a seamless setup. The extension badge shows status (ON/OFF).
258
+
259
+ ### Default Settings (Extension)
260
+
261
+ | Setting | Default |
262
+ |---------|---------|
263
+ | Relay port | `8787` |
264
+ | Auto-connect | `true` |
265
+ | Auto-pair | `true` |
266
+ | Require pairing token | `true` |
267
+ | Pairing token | `null` (fetched on connect) |
268
+
269
+ ### Connection Flow (Extension Relay)
270
+
271
+ 1. Extension checks the discovery endpoint at `http://127.0.0.1:8787/config`.
272
+ 2. It learns the relay port and whether pairing is required.
273
+ 3. If pairing is required and Auto-pair is on, it fetches the token from `http://127.0.0.1:<relayPort>/pair`.
274
+ 4. It connects to `ws://127.0.0.1:<relayPort>/extension` using the extension origin.
275
+
276
+ `/config` and `/pair` are extension-origin only for CSWSH protection.
277
+
122
278
  ### Manual Setup
123
279
 
124
- 1. Install extension from Chrome Web Store or load unpacked from `~/.cache/opencode/opendevbrowser-extension/`
125
- 2. Open extension popup
126
- 3. Enter same port/token as plugin config
127
- 4. Click Connect
280
+ 1. Start OpenCode once so the plugin can extract the extension assets.
281
+ 2. Load unpacked from `~/.config/opencode/opendevbrowser/extension`
282
+ (fallback: `~/.cache/opencode/node_modules/opendevbrowser/extension`).
283
+ 3. Open extension popup
284
+ 4. Enter the same relay port and token as the plugin config
285
+ (if `relayToken` is missing, either add one to `opendevbrowser.jsonc` or use Auto-Pair).
286
+ 5. Click Connect
287
+
288
+ ### Where Extension Assets Live
289
+
290
+ Extension assets are bundled inside the NPM package and extracted on install/startup:
291
+
292
+ - Primary: `~/.config/opencode/opendevbrowser/extension`
293
+ - Fallback: `~/.cache/opencode/node_modules/opendevbrowser/extension`
294
+
295
+ Extraction is handled by `extractExtension()` (see `src/extension-extractor.ts`).
128
296
 
129
297
  ---
130
298
 
@@ -134,42 +302,56 @@ Optional config file: `~/.config/opencode/opendevbrowser.jsonc`
134
302
 
135
303
  ```jsonc
136
304
  {
305
+ // Browser settings
137
306
  "headless": false,
138
307
  "profile": "default",
139
308
  "persistProfile": true,
309
+ "chromePath": "/path/to/chrome", // Custom Chrome executable
310
+ "flags": ["--disable-extensions"], // Additional Chrome flags
311
+
312
+ // Snapshot limits
140
313
  "snapshot": { "maxChars": 16000, "maxNodes": 1000 },
314
+
315
+ // Export limits
141
316
  "export": { "maxNodes": 1000, "inlineStyles": true },
317
+
318
+ // DevTools output
142
319
  "devtools": { "showFullUrls": false, "showFullConsole": false },
320
+
321
+ // Security (all default false for safety)
143
322
  "security": {
144
323
  "allowRawCDP": false,
145
324
  "allowNonLocalCdp": false,
146
325
  "allowUnsafeExport": false
147
326
  },
327
+
328
+ // Skills configuration
329
+ "skills": {
330
+ "nudge": {
331
+ "enabled": true,
332
+ "keywords": ["form", "login", "extract", "scrape"],
333
+ "maxAgeMs": 60000
334
+ }
335
+ },
336
+ "skillPaths": ["./custom-skills"], // Additional skill directories
337
+
338
+ // Continuity ledger
148
339
  "continuity": {
149
340
  "enabled": true,
150
341
  "filePath": "opendevbrowser_continuity.md",
151
342
  "nudge": {
152
343
  "enabled": true,
153
- "keywords": [
154
- "plan",
155
- "multi-step",
156
- "multi step",
157
- "long-running",
158
- "long running",
159
- "refactor",
160
- "migration",
161
- "rollout",
162
- "release",
163
- "upgrade",
164
- "investigate",
165
- "follow-up",
166
- "continue"
167
- ],
344
+ "keywords": ["plan", "multi-step", "refactor", "migration"],
168
345
  "maxAgeMs": 60000
169
346
  }
170
347
  },
348
+
349
+ // Extension relay
171
350
  "relayPort": 8787,
172
- "relayToken": "auto-generated-on-first-run"
351
+ "relayToken": "auto-generated-on-first-run",
352
+
353
+ // Updates
354
+ "checkForUpdates": false
173
355
  }
174
356
  ```
175
357
 
@@ -214,7 +396,8 @@ rm -rf ~/.cache/opencode/node_modules/opendevbrowser
214
396
  npx opendevbrowser --update
215
397
  ```
216
398
 
217
- Release checklist: `docs/DISTRIBUTION_PLAN.md`
399
+ Architecture overview: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
400
+ Release checklist: [docs/DISTRIBUTION_PLAN.md](docs/DISTRIBUTION_PLAN.md)
218
401
 
219
402
  ---
220
403
 
@@ -226,8 +409,24 @@ npm run build # Compile to dist/
226
409
  npm run test # Run tests with coverage
227
410
  npm run lint # ESLint checks
228
411
  npm run extension:build # Compile extension
412
+ npm run version:check # Verify package/extension version alignment
413
+ npm run extension:pack # Build extension zip for releases
229
414
  ```
230
415
 
416
+ ### Packaging & Distribution (NPM + GitHub + Extension)
417
+
418
+ Uniform versioning is required (source of truth: `package.json`):
419
+
420
+ 1. Bump `package.json` version.
421
+ 2. Run: `npm run extension:sync`
422
+ 3. Run: `npm run version:check`
423
+ 4. Run: `npm run build`
424
+ 5. Run: `npm run extension:build`
425
+ 6. Run: `npm run extension:pack` (outputs `./opendevbrowser-extension.zip`)
426
+ 7. Publish to NPM and attach the zip to the GitHub release tag (`vX.Y.Z`).
427
+
428
+ Release checklist: `docs/DISTRIBUTION_PLAN.md`
429
+
231
430
  ---
232
431
 
233
432
  ## Privacy