browse 0.8.4 → 0.8.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browse",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Unified Browserbase CLI for browser automation and cloud APIs.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -27,7 +27,8 @@
27
27
  "hooks": {
28
28
  "init": "./dist/hooks/init.js",
29
29
  "prerun": "./dist/hooks/prerun.js",
30
- "finally": "./dist/hooks/finally.js"
30
+ "finally": "./dist/hooks/finally.js",
31
+ "command_not_found": "./dist/hooks/command-not-found.js"
31
32
  },
32
33
  "topicSeparator": " ",
33
34
  "topics": {
@@ -91,6 +92,8 @@
91
92
  "archiver": "^7.0.1",
92
93
  "deepmerge": "^4.3.1",
93
94
  "dotenv": "^16.5.0",
95
+ "fastest-levenshtein": "^1.0.16",
96
+ "http-status-codes": "^2.3.0",
94
97
  "ignore": "^7.0.5",
95
98
  "node-html-markdown": "^1.3.0",
96
99
  "semver": "^7.7.4",
@@ -112,7 +115,7 @@
112
115
  "prettier": "3.5.3",
113
116
  "typescript": "^5.8.3",
114
117
  "typescript-eslint": "^8.59.3",
115
- "vitest": "^4.1.6"
118
+ "vitest": "^4.1.9"
116
119
  },
117
120
  "scripts": {
118
121
  "build": "node -e \"const fs = require('fs'); fs.rmSync('dist', { recursive: true, force: true }); fs.rmSync('oclif.manifest.json', { force: true })\" && tsc -p tsconfig.json && pnpm manifest",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: browse
3
- description: Use the browse CLI for Browserbase browser automation, Browserbase cloud APIs, Browserbase Functions, templates, web fetch/search, diagnostics, and Browse.sh skill discovery/installation. Use when the user asks to navigate pages, inspect browser state, run local or remote browser sessions, manage Browserbase resources, call Browserbase Functions, browse or scaffold Browserbase templates, fetch or search web content, diagnose browse setup, discover site-specific Browse.sh skills, or install/refresh this browse skill.
3
+ description: Use the browse CLI for Browserbase browser automation, Browserbase cloud APIs, Browserbase Functions, templates, web fetch/search, diagnostics, and Browse.sh skill discovery/installation. Use when the user asks to navigate pages, inspect browser state, run local or remote browser sessions, manage Browserbase resources, call Browserbase Functions, browse or scaffold Browserbase templates, fetch or search web content, diagnose browse setup, find or install a skill for a website task, discover site-specific Browse.sh skills, or install/refresh this browse skill.
4
4
  compatibility: "Requires the browse CLI (`npm install -g browse`). Remote Browserbase sessions and cloud API commands require `BROWSERBASE_API_KEY`. Local mode uses Chrome/Chromium on the machine."
5
5
  license: MIT
6
6
  allowed-tools: Bash
@@ -64,6 +64,15 @@ browse open https://example.com --cdp ws://127.0.0.1:9222/devtools/browser/<id>
64
64
 
65
65
  Use local mode for development, localhost, trusted sites, and fast iteration. Use `--auto-connect` only when the user explicitly wants to attach to an already-running debuggable Chrome session with existing cookies or login state; use `--local` when no debuggable Chrome is available. Use remote mode when Browserbase credentials are available and the site needs hosted browser infrastructure, Verified browser mode, CAPTCHA solving, proxies, or session persistence.
66
66
 
67
+ Choose headed/headless and local/remote mode when starting a session. A running session keeps its mode: passing a conflicting flag such as `--headed` to an already-running headless session fails until you run `browse stop --session <name>` or target a different session.
68
+
69
+ Use named sessions for any non-trivial work, especially when multiple agents or parallel tasks may run at once. Every browser command accepts `--session <name>` (or `-s <name>`); the `BROWSE_SESSION` env var sets the default, and commands without either share the `default` session.
70
+
71
+ ```bash
72
+ browse open https://example.com --session research --local
73
+ browse snapshot --session research
74
+ ```
75
+
67
76
  Remote browser and cloud API commands require:
68
77
 
69
78
  ```bash
@@ -75,16 +84,35 @@ export BROWSERBASE_API_KEY=...
75
84
  Start by opening the page, then inspect state, act, and verify.
76
85
 
77
86
  ```bash
78
- browse open https://example.com --local
79
- browse snapshot
80
- browse click @0-5
81
- browse type "hello"
82
- browse snapshot
83
- browse stop
87
+ browse open https://example.com --session research --local
88
+ browse snapshot --session research
89
+ browse click @0-5 --session research
90
+ browse type "hello" --session research
91
+ browse snapshot --session research
92
+ browse stop --session research
84
93
  ```
85
94
 
86
95
  Prefer `browse snapshot` over screenshots for most browser work. It is structured, fast, and returns refs like `@0-5` for reliable element interaction. Use screenshots when visual layout, images, or pixel-level state matter.
87
96
 
97
+ Refs are refreshed on every snapshot. After clicks, form submits, navigation, or UI re-renders, take a new snapshot before using another ref.
98
+
99
+ ## Parallel Browser Work
100
+
101
+ Use a different `--session` value for each independent browser task. Sessions isolate tabs, cookies, refs, and daemon state; parallel tasks that omit `--session` share the `default` session and overwrite each other's active page.
102
+
103
+ ```bash
104
+ browse open https://example.com/search-a --session search-a --local
105
+ browse open https://example.com/search-b --session search-b --local
106
+ browse snapshot --session search-a
107
+ browse snapshot --session search-b
108
+ ```
109
+
110
+ When a task is complete, stop only that task's session:
111
+
112
+ ```bash
113
+ browse stop --session search-a
114
+ ```
115
+
88
116
  ## Core Browser Commands
89
117
 
90
118
  Navigation:
@@ -165,6 +193,15 @@ browse stop --force
165
193
 
166
194
  Use `browse doctor` before debugging a broken browser session. Use `browse doctor --json` when another agent or CI needs structured diagnostics.
167
195
 
196
+ If a page command reports that no active page is available, inspect and recover the named session:
197
+
198
+ ```bash
199
+ browse status --session research
200
+ browse tab list --session research
201
+ browse tab new https://example.com --session research
202
+ browse open https://example.com --session research
203
+ ```
204
+
168
205
  ## Cloud APIs
169
206
 
170
207
  Use `browse cloud` for Browserbase platform APIs:
@@ -242,18 +279,49 @@ Install or refresh this bundled CLI skill:
242
279
  browse skills install
243
280
  ```
244
281
 
245
- Discover and install site-specific Browse.sh skills:
282
+ ### Discovering Browse.sh Skills
283
+
284
+ Browse.sh (https://browse.sh) is a catalog of site-specific browser automation skills. Each skill is scoped to one task on one website and identified by a `<domain>/<task>` slug. An installed skill encodes a proven strategy for that site — API endpoints, selectors, anti-bot handling — so it completes the task faster and more reliably than exploring the site from scratch.
285
+
286
+ Search the catalog proactively when:
287
+
288
+ - the user asks to complete a task on a specific website — search the domain before automating it by hand
289
+ - the user asks for a task in a common category like flights, food delivery, reviews, recipes, tickets, jobs, or shopping — search the keyword
290
+ - the user asks "is there a skill for X" or wants new capabilities
291
+
292
+ ```bash
293
+ browse skills list # browse the catalog
294
+ browse skills find <query> # search by slug, domain, title, description, category, alias, or tag
295
+ browse skills add <domain>/<task> # install an exact slug
296
+ ```
297
+
298
+ ### Search Strategy
299
+
300
+ Search the domain first, then the task, then broaden:
301
+
302
+ ```bash
303
+ browse skills find yelp.com # 1. exact domain
304
+ browse skills find yelp # 2. site name
305
+ browse skills find reviews # 3. task keyword
306
+ browse skills find "restaurant reviews" # 4. multi-word query
307
+ browse skills find food --limit 5 # 5. category keyword, capped
308
+ ```
309
+
310
+ - Querying an exact slug (`browse skills find yelp.com/extract-reviews-2ikb22`) prints a detail view with the full description and install command.
311
+ - If a search returns nothing, try synonyms (`flights` vs `travel`, `food` vs `restaurants`) before concluding no skill exists.
312
+ - Each result shows a recommended method — `api`, `fetch`, `browser`, or `hybrid` — indicating how the skill drives the site. Install counts signal which skills are proven.
313
+ - Many slugs end in a generated suffix (`-2ikb22`), so never guess or construct them. Install only with an exact slug copied from `list` or `find` output: `browse skills add yelp.com/extract-reviews-2ikb22`. The installed skill becomes available to the agent as a regular skill; a new agent session may be needed to pick it up.
314
+
315
+ ### Output Formats
316
+
317
+ Output is a table in a terminal and JSON when piped, so agents get structured JSON by default. Force a format with `--format table|json` or `--json`.
246
318
 
247
319
  ```bash
248
- browse skills list
249
- browse skills list --json
250
- browse skills find reviews
251
- browse skills find yelp.com/extract-reviews
252
- browse skills find "restaurant reviews" --json
253
- browse skills add yelp.com/extract-reviews
320
+ browse skills find food --format table --limit 10
321
+ browse skills find food --json | jq -r '.skills[] | "\(.slug)\t\(.title)"'
254
322
  ```
255
323
 
256
- Use `browse skills find` when the exact skill slug is uncertain. Use `browse skills add <domain>/<task>` only after choosing an exact slug from `list` or `find`.
324
+ JSON output includes every match with full descriptions and ignores `--limit`; `browse skills list --json` returns the entire catalog, which is large. Prefer `browse skills find <query>` to narrow first, or `--format table --limit <n>` for a compact view.
257
325
 
258
326
  ## Best Practices
259
327
 
@@ -262,16 +330,23 @@ Use `browse skills find` when the exact skill slug is uncertain. Use `browse ski
262
330
  3. Re-run `browse snapshot` after navigation or DOM-changing actions because refs can change.
263
331
  4. Prefer refs from snapshots for clicks and uploads; use selectors or XPath when refs are unavailable.
264
332
  5. Use `--local` for localhost and repeatable development; use `--remote` for protected sites or Browserbase-specific behavior.
265
- 6. Use `--auto-connect` only when attaching to an existing debuggable local Chrome session is intended.
266
- 7. Use `browse doctor` when session startup, browser discovery, CDP attach, or Browserbase auth looks wrong.
267
- 8. Use `browse stop` when finished to clean up daemon state.
268
- 9. For unfamiliar command details, run `browse <topic> --help` and follow the exact dash-case flags.
333
+ 6. Use a distinct `--session <name>` for each parallel or long-running task; commands without the flag share the `default` session.
334
+ 7. Use `--auto-connect` only when attaching to an existing debuggable local Chrome session is intended.
335
+ 8. Use `browse doctor` when session startup, browser discovery, CDP attach, or Browserbase auth looks wrong.
336
+ 9. Never retry a failing command unchanged. If the same command fails twice with the same error, stop — run `browse doctor --json`, then change approach (fix the key, switch `--local`/`--remote`, or `browse stop --force` and start fresh). Repeating an identical failing command will keep failing.
337
+ 10. Use `browse stop` (or `browse stop --session <name>`) when finished to clean up daemon state.
338
+ 11. For unfamiliar command details, run `browse <topic> --help` and follow the exact dash-case flags.
269
339
 
270
340
  ## Troubleshooting
271
341
 
272
- - "No active page": run `browse status`, then `browse open <url>` or `browse stop --force` if the daemon is stale.
342
+ - "No active page": run `browse status --session <name>`, then `browse open <url> --session <name>` or `browse tab new <url> --session <name>`; use `browse stop --force` if the daemon is stale.
273
343
  - Chrome not found: use `--remote` with Browserbase credentials, install Chrome, or attach with `--cdp`.
274
344
  - Action fails: run `browse snapshot` and use a visible ref from the current page state.
345
+ - 401 Unauthorized on `open`, `get`, or other driver commands: a set `BROWSERBASE_API_KEY` makes `browse` default to remote mode. Fix the key at https://browserbase.com/settings, unset it, or pass `--local` to run a managed local browser (no key needed).
346
+ - Same command fails twice with the same error: stop retrying — never retry a failing command unchanged. Init failures are cached for several seconds, so instant retries return identical errors. Run `browse doctor --json`, then change approach: fix the key, switch `--local`/`--remote`, or `browse stop --force` and start fresh.
275
347
  - Remote command fails: verify `BROWSERBASE_API_KEY` and inspect `browse cloud projects list`.
276
348
  - Session setup is unclear: run `browse doctor` or `browse doctor --json`.
277
349
  - Protected site blocks local mode: retry with `--remote`.
350
+ - `browse skills find` returns nothing: broaden the query — bare domain, then site name, then a task keyword or synonym.
351
+ - `browse skills add` fails on `npx`: install Node.js from https://nodejs.org, then rerun.
352
+ - Newly added skill is not available: it installs for future sessions; list installed skills or start a new agent session.