browse
Version:
Unified Browserbase CLI for browser automation and cloud APIs.
120 lines (94 loc) • 4.36 kB
Markdown
# Browse CLI
The Browserbase CLI is being rebuilt as the `browse` command.
This branch is the oclif migration base for the new CLI surface. Browserbase cloud API commands are available under `browse cloud`, and the first native browser driver commands are available at the top level.
## Installation
```bash
npm install -g browse
```
Requires Node.js 20.19+ or 22.12+.
## Driver Commands
```bash
browse open https://example.com
browse open https://example.com --local --headed
browse open https://example.com --remote
browse open https://example.com --auto-connect
browse open https://example.com --cdp 9222
browse open https://example.com --cdp ws://127.0.0.1:9222/devtools/browser/<id> --target-id <target-id>
browse snapshot --compact
browse click @0-12
browse fill @0-8 "hello"
browse mouse click 240 320
browse get title
browse screenshot --path page.png
browse tab list
browse tab switch <target-id>
browse network on
browse cdp 9222 --pretty
browse status
browse stop
```
Driver commands auto-start the hidden daemon when needed and print structured JSON by default for agent-friendly consumption. Semantic element commands accept refs from `browse snapshot`, XPath, or selectors. Raw viewport input lives under `browse mouse`.
Use `--local`, `--remote`, `--auto-connect`, or `--cdp <url|port>` per command to choose the browser target. Use `--target-id <id>` with `--cdp` when attaching to a specific CDP target. Driver commands use `BROWSERBASE_API_KEY` for remote Browserbase sessions.
Security note: `browse network on` writes request/response headers and bodies to a local owner-only capture directory. These files can include cookies, authorization headers, and other secrets, so use network capture only on trusted machines and run `browse network clear` when done.
## Cloud Commands
```bash
browse --help
browse cloud --help
browse cloud projects list
browse cloud projects get <project-id>
browse cloud projects usage <project-id>
browse cloud sessions list
browse cloud sessions get <session-id>
browse cloud sessions create
browse cloud sessions update <session-id>
browse cloud sessions debug <session-id>
browse cloud sessions logs <session-id>
browse cloud sessions downloads get <session-id>
browse cloud sessions uploads create <session-id> <file>
browse cloud contexts create
browse cloud contexts get <context-id>
browse cloud contexts update <context-id>
browse cloud contexts delete <context-id>
browse cloud extensions upload <file>
browse cloud extensions get <extension-id>
browse cloud extensions delete <extension-id>
browse cloud fetch <url>
browse cloud search <query>
```
## Functions Commands
```bash
browse functions init my-function
browse functions dev index.ts
browse functions publish index.ts
browse functions publish index.ts --dry-run
browse functions invoke <function-id> --params '{"url":"https://example.com"}'
browse functions invoke --check-status <invocation-id>
```
Functions commands use `BROWSERBASE_API_KEY` for Browserbase API access. Generated projects import `defineFn` from `@browserbasehq/sdk-functions`.
`browse functions dev` binds to loopback by default and only allows browser CORS requests from loopback origins.
## Skills
```bash
browse skills install
browse skills list
browse skills find reviews
browse skills find yelp.com/extract-reviews
browse skills add yelp.com/extract-reviews
browse skills add mcdonalds.order.online/order-delivery-42q71n
```
`browse skills install` installs the bundled `browse` CLI skill from this package.
`browse skills list` lists the public Browse.sh skill catalog.
`browse skills find` searches the public Browse.sh skill catalog by slug, domain, title, description, category, alias, or tag.
`browse skills add` installs catalog skills from `browserbase/browse.sh` or generated skills from Browserbase-hosted public storage.
Set `BROWSE_SKILLS_API_BASE_URL` to test catalog discovery or generated skill file discovery against a staging Browse.sh API endpoint. Set `BROWSE_SKILLS_BLOB_BASE_URL` to test direct Blob fallback downloads.
Auth and manual daemon start are intentionally not implemented in this branch.
## Development
```bash
bun install
bun run prepare
bun run cli -- --help
bun run lint
bun run build
bun run test
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.