109 Commits

Author SHA1 Message Date
yan5xu 0f83288ece chore: rename bb-browser-sites skill to bb-browser-openclaw
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.6.0
2026-03-15 13:47:16 +08:00
yan5xu 1a79c3f7d1 chore: bump version to 0.6.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:40:33 +08:00
yan5xu facd29d2d4 feat: add bb-browser-sites skill for OpenClaw
Dedicated skill that guides OpenClaw agents to use --openclaw mode.
No Chrome extension or daemon needed — runs adapters directly through
OpenClaw's CDP browser.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:38:51 +08:00
yan5xu 701fa7bc7e feat(site): add --openclaw mode to run adapters via OpenClaw CDP browser
Run site adapters directly through OpenClaw's built-in Chrome browser,
without needing bb-browser's Chrome extension or daemon.

  bb-browser site v2ex/hot --openclaw
  bb-browser site zhihu/hot 3 --openclaw --jq '.items[].title'

The bridge (openclaw-bridge.ts, ~40 lines) uses `npx openclaw browser`
commands: tabs/open/evaluate. Adapter JS is passed directly via
execFileSync to avoid shell escaping issues.

Existing daemon-based flow is unchanged when --openclaw is not set.

Closes #28

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:35:00 +08:00
yan5xu 423e430765 chore: bump version to 0.5.2
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.5.2
2026-03-15 12:48:08 +08:00
yan5xu 5e8ca91d4e fix(extension): never give up reconnecting to daemon
Previously the extension would stop reconnecting after 5 attempts
(~93s total). If the daemon wasn't running when the extension started,
users had to manually reload the extension after starting the daemon.

Now the extension retries indefinitely with exponential backoff capped
at 60s, and suppresses error logs when daemon is simply not running.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:47:19 +08:00
yan5xu b478226d74 fix(cli): wait for extension connection before sending commands
ensureDaemonRunning() previously returned as soon as the daemon HTTP
server was ready, but the Chrome extension might not have connected
via SSE yet. This caused intermittent "extension not connected" (503)
or "Failed to fetch" errors on the first command.

Now polls /status for extensionConnected (up to 10s) after daemon
starts, ensuring the full CLI → daemon → extension pipeline is ready
before sending any command.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:46:12 +08:00
yan5xu c9d28d5d4e chore: bump version to 0.5.1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.5.1
2026-03-15 12:37:42 +08:00
yan5xu 638020d3bb feat(site): silent background update after every site command
Spawn a detached `git pull --ff-only` in the background after each
site command. Non-blocking, no output, keeps community adapters fresh
without user intervention.

Closes #20

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:36:20 +08:00
Yanwu c1c9bc42a8 Merge pull request #26 from epiral/feat/ux-agent-guide
feat: Agent UX guide system + history, site recommend/info, --jq
v0.5.0
2026-03-15 12:17:28 +08:00
yan5xu 31fb169516 fix(site): filter noise from recommend not_available list
- Only show domains with >= 5 visits
- Exclude localhost and non-domain strings (e.g. Chrome extension IDs)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:16:42 +08:00
yan5xu 526551e071 fix(extension): add history permission to source manifest
The previous patch only modified extension/manifest.json (build output,
gitignored) instead of packages/extension/manifest.json (source). Every
vite build overwrote the fix. Now the source manifest has the history
permission so it survives rebuilds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:15:10 +08:00
yan5xu e8e1ec088c docs: update README for v0.5.0 — site recommend, --jq, xueqiu
- Quick Start: replace `site list` with `site recommend`
- Update platform count: 36 platforms, 103 commands
- Add Xueqiu to Finance category
- Document --jq and site info with examples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:04:45 +08:00
yan5xu f96490d8d7 chore: bump version to 0.5.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:02:18 +08:00
yan5xu fdb8288ce2 feat: add history, site recommend, site info, --jq, and Agent UX guide
New commands:
- `history search/domains` — query Chrome browsing history via chrome.history API
- `site recommend` — cross-reference history with adapters for personalized discovery
- `site info <name>` — expose full adapter @meta (args, example, domain)
- `--jq <expr>` — inline jq-like JSON filtering (inspired by gh CLI)

Agent UX improvements:
- --help grouped by intent, "开始使用" section first with site examples
- --help top hint explicitly guides Agents to use site commands over browser automation
- `open` command shows 💡 hint when the URL has available site adapters
- `--jq` auto-strips `.data.` prefix for Agent tolerance
- `site update` post-install nudge for site recommend
- AGENTS.md with full UX writing spec for contributors

Closes #21, closes #23, relates #24

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:02:04 +08:00
yan5xu 732006aded docs: add daemon --host configuration section
Document the --host flag for daemon bind address customization:
- 127.0.0.1 for IPv4-only (fixes macOS IPv6 issues, ref #18)
- 0.0.0.0 for remote access via Tailscale / ZeroTier

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 11:15:22 +08:00
yan5xu 4b903e2a8b docs: rewrite README — 35 platforms, 97 commands, the vision
- Update numbers: 10 platforms → 35, 50+ → 97 commands
- Add "The idea" section: browser IS the API, not the other way around
- Add "What this means for AI agents": files + terminal + entire internet
- Add "10 minutes to add any website" with tier system and parallel AI proof
- Full platform table by category
- Bilingual (EN + ZH)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 02:25:07 +08:00
yan5xu 73c4891e6e chore: bump version to 0.4.5
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 01:22:48 +08:00
Yanwu bed7fbd987 feat(cli): categorize --help output, promote site system (#14)
Group commands by function (site adapters, navigation, interaction,
page info, network/debug, daemon) instead of a flat list.

Move site adapter section to the top with usage examples, making
the most powerful feature immediately visible.

Closes #13

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 01:22:24 +08:00
yan5xu 4df715e164 docs: rewrite README — site adapters as the hero feature
Lead with 50+ site commands across 10 platforms instead of
generic browser automation. That's what makes bb-browser different.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 01:09:19 +08:00
yan5xu 40c8567514 chore: bump version to 0.4.4 2026-03-15 00:30:57 +08:00
yan5xu 94070402e1 fix(site): add guide hint to site --help 2026-03-15 00:30:01 +08:00
yan5xu 09ac697877 fix(cli): add guide command to help text 2026-03-15 00:27:33 +08:00
yan5xu 52b4aa7314 chore: bump version to 0.4.3 2026-03-15 00:17:37 +08:00
yan5xu bd9e89619c feat(guide): add bb-browser site adapter as gh CLI alternative
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 00:15:06 +08:00
yan5xu f0869aabef feat: add MCP instructions + bb-browser guide command
MCP server now sends instructions on connect so agents immediately
understand what bb-browser can do (capabilities, site adapters, etc).

New top-level `bb-browser guide` command teaches how to turn any
website into a site adapter — reverse engineer, write, test, contribute.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 00:13:14 +08:00
yan5xu 51d9d56acb chore: update description 2026-03-14 23:26:35 +08:00
yan5xu 1698c27d7a chore: bump version to 0.4.2 2026-03-14 23:23:24 +08:00
yan5xu 847a995db7 feat(site): include bb-browser site adapter as report alternative
reportHint now shows two options for agents:
1. gh issue create --repo epiral/bb-sites
2. bb-browser site github/issue-create epiral/bb-sites

Agents choose whichever tool is available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 23:21:21 +08:00
yan5xu de713a2761 feat(site): add reportHint in error output for agents
When a site adapter fails, include a reportHint field telling the
agent how to file an issue via `gh issue create --repo epiral/bb-sites`.
Agents decide themselves whether to use gh CLI or bb-browser's own
github site adapter.

Remove site report subcommand — agents handle reporting autonomously.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 23:19:48 +08:00
yan5xu 9d8594a168 fix(site): detect auth errors in adapter hint text too
Check both error and hint fields for auth keywords.
When detected, replace with actionable login URL hint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 23:02:57 +08:00
yan5xu c68653b2fa feat(site): auto-detect auth errors and show login hint
When a site adapter returns 401/403/unauthorized errors, automatically
suggest the user to log in to the site's domain in their browser.
Works in both CLI and JSON output modes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:59:35 +08:00
yan5xu 01788c5cbb docs: add privacy policy for Chrome Web Store
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:51:15 +08:00
yan5xu ce12d3a9f8 fix: simplify extension setup hints to 4 clear steps
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:28:55 +08:00
yan5xu 0491e72c4f fix: improve extension setup hints with direct download link
Point to releases/latest for zip download, simplify steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:28:04 +08:00
yan5xu fa33c5af2a feat(mcp): auto-start daemon when not running
MCP server now spawns daemon automatically on first tool call,
same as CLI does. Only shows setup hint for extension not connected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:26:22 +08:00
yan5xu 1f15f3e433 feat(cli,mcp): add setup hints when extension/daemon not connected
Show actionable setup guide when:
- Daemon not running (ECONNREFUSED)
- Extension not connected (HTTP 503)

Hints include install steps and GitHub releases link, guiding both
users and AI agents to complete the setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:23:05 +08:00
yan5xu 15661ba276 chore: bump extension version to 0.4.1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.4.1
2026-03-14 22:19:54 +08:00
yan5xu cb28e815aa feat(cli): add --mcp flag to start MCP server
`bb-browser --mcp` spawns the MCP server with stdio transport.
Users can configure AI tools with: npx -y bb-browser --mcp

Also fixes root tsup bundling to properly exclude ws while
bundling all other deps (MCP SDK, ajv, zod).

Bump version to 0.4.1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:15:33 +08:00
yan5xu eb62804e1f chore: prepare v0.4.0 for npm publish
- Bump version to 0.4.0
- Add MCP runtime deps (ajv, ajv-formats, @modelcontextprotocol/sdk)
- Bundle all deps in root tsup for npx compatibility
- Fix repo URL to epiral/bb-browser
- Add mcp keyword

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:03:32 +08:00
yan5xu 537e5536f9 feat(mcp): add MCP server for AI agent integration
New package @bb-browser/mcp exposes all browser commands as MCP tools:
browser_snapshot, browser_click, browser_fill, browser_type, browser_open,
browser_tab_list, browser_tab_new, browser_press, browser_scroll,
browser_eval, browser_network, browser_screenshot, browser_get,
browser_close, browser_hover, browser_wait

All tools support `tab` parameter for concurrent multi-tab operations.
Uses stdio transport, connects to daemon via HTTP (same as CLI).

Also adds missing fields to shared protocol types:
- Request: key, modifiers, direction, pixels, waitType, ms
- ResponseData: dataUrl

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 21:59:22 +08:00
yan5xu c3fa112624 fix(cli): daemon command works in npm-published layout
Replace broken `import("@bb-browser/daemon")` with `spawn(getDaemonPath())`
so `bb-browser daemon` works both in dev monorepo and npm install scenarios.

- Export getDaemonPath() from daemon-manager
- daemon command uses spawn with stdio: "inherit" for foreground mode
- Pass --host flag through to daemon process

Fixes #6, fixes #10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 21:49:39 +08:00
yan5xu a882809abc fix(cli): --tab flag works correctly for all commands
- parseArgs: remove `&& !result.command` guard so --tab value is not
  leaked into command args (e.g. network filter)
- site: respect --tab, stop calling tab_select (no foreground steal)
- fetch: stop calling tab_select (no foreground steal)
- site --json: wrap output in standard {id, success, data} envelope

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 21:46:42 +08:00
yan5xu 50d7558742 docs: split README into English + Chinese files
- README.md: English (default)
- README.zh-CN.md: Chinese
- Cross-linked via header

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 21:25:12 +08:00
yan5xu 0d33a84a0e docs: rewrite README — BadBoy Browser, bilingual, new capabilities
- Rename narrative: bb = BadBoy Browser
- Tagline: "Your browser is the API. No keys. No bots. No scrapers."
- Add fetch, site, network --with-body to command reference
- Bilingual: English (default) + Chinese section
- Reframe positioning: not automation, not scraping — being the browser

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 21:23:15 +08:00
yan5xu a2e1f29daa feat: network requests --with-body captures full request/response data
Via CDP Network.loadingFinished + Network.getResponseBody, capture:
- Request headers and body (POST data)
- Response headers, body, and mimeType
- Memory management: 256KB/response, 64KB/request, 8MB/tab total
- Eviction: oldest bodies removed first when over budget
- Graceful error handling: bodyError field for failed captures

This enables a new paradigm for site adapters: instead of reverse-engineering
API signing (like Xiaohongshu's X-s), just navigate to a page and read the
response bodies from requests the page already made with proper authentication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 20:44:22 +08:00
yan5xu f63a1f4c9d refactor: recipe → site, fix Codex review criticals
Rename:
- recipe.ts → site.ts, command `recipe` → `site`
- bb-recipes → bb-sites, ~/.bb-browser/bb-recipes → bb-sites

Codex review fixes (fetch.ts):
- Fix headers injection: validate as JSON instead of string interpolation
- Fix origin matching: exact hostname comparison instead of includes()
- Fix method normalization: toUpperCase() + exclude HEAD from body
- Fix JSON parse on 204: skip resp.json() for empty responses
- Remove duplicate --json/non-json output branches

Codex review fixes (site.ts):
- Parse /* @meta JSON */ block comment format (with @tag fallback)
- Structured args: required/optional per-arg, skip optional in validation
- Fix arg parsing: separate --flag values from positional args
- Fix tab routing: exact origin match via URL parsing
- Capture tabId from new tab and pass to eval
- Surface adapter {error, hint} as CLI errors instead of normal output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 17:16:14 +08:00
yan5xu 56684707da feat: add fetch and recipe commands
- `bb-browser fetch <url>`: browser-native fetch with auto same-origin tab routing.
  Like curl but with browser login state. No API keys, no anti-bot.

- `bb-browser recipe`: manage and run community/private fetch recipes.
  - recipe list: scan ~/.bb-browser/recipes/ (local) and ~/.bb-browser/bb-recipes/ (community)
  - recipe search <query>: keyword search across recipes
  - recipe run <name> [args]: execute a recipe via eval
  - recipe update: git clone/pull community recipes from epiral/bb-recipes
  - recipe <name> [args]: shorthand for recipe run

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 16:54:09 +08:00
yan5xu 4eea8e5880 fix(daemon): allow positional args in parseArgs for CLI passthrough
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-11 16:45:18 +08:00
yan5xu 3a69040bf7 feat(daemon): add --host flag to configure listen address
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-11 16:45:13 +08:00