bb-browser 0.4.3 → 0.4.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/README.md +74 -108
- package/README.zh-CN.md +73 -107
- package/dist/cli.js +71 -77
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,154 +16,120 @@
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
You're already logged into
|
|
19
|
+
You're already logged into Reddit, Twitter, YouTube, Zhihu, Bilibili, Weibo, Douban, Xiaohongshu — bb-browser lets AI agents **use that directly**.
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
bb-browser
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
```bash
|
|
22
|
+
bb-browser site zhihu/hot # 知乎热榜
|
|
23
|
+
bb-browser site weibo/hot # 微博热搜
|
|
24
|
+
bb-browser site bilibili/popular # B站热门
|
|
25
|
+
bb-browser site douban/top250 # 豆瓣 Top 250
|
|
26
|
+
bb-browser site youtube/transcript VIDEO_ID # YouTube 字幕全文
|
|
27
|
+
bb-browser site reddit/thread URL # Reddit 讨论树
|
|
28
|
+
bb-browser site twitter/user elonmusk # Twitter 用户资料
|
|
29
|
+
bb-browser site xiaohongshu/search 美食 # 小红书搜索
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
**50+ commands across 10 platforms.** All using your real browser's login state. [Full list →](https://github.com/epiral/bb-sites)
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
## Why this is different
|
|
35
|
+
|
|
36
|
+
Every browser automation tool can click buttons and fill forms. bb-browser does that too. But the real power is **site adapters** — pre-built commands that turn any website into a CLI/API, using your browser's login state.
|
|
37
|
+
|
|
38
|
+
How it works under the hood: the adapter runs `eval` inside your browser tab. It calls `fetch()` with your cookies, or invokes the page's own Vue/Pinia store actions. The website thinks it's you. Because it **is** you.
|
|
35
39
|
|
|
36
40
|
| | Playwright / Selenium | Scraping libs | bb-browser |
|
|
37
41
|
|---|---|---|---|
|
|
38
42
|
| Browser | Headless, isolated | No browser | Your real Chrome |
|
|
39
43
|
| Login state | None, must re-login | Cookie extraction | Already there |
|
|
40
|
-
| Anti-bot | Detected easily | Cat-and-mouse
|
|
41
|
-
|
|
|
44
|
+
| Anti-bot | Detected easily | Cat-and-mouse | Invisible — it IS the user |
|
|
45
|
+
| XHS signing | Can't replicate | Reverse engineer | Page signs it itself |
|
|
42
46
|
|
|
43
|
-
##
|
|
47
|
+
## Quick Start
|
|
44
48
|
|
|
45
|
-
###
|
|
49
|
+
### Install
|
|
46
50
|
|
|
47
51
|
```bash
|
|
48
|
-
bb-browser
|
|
49
|
-
bb-browser snapshot -i # interactive elements only
|
|
50
|
-
bb-browser click @0 # click by ref
|
|
51
|
-
bb-browser fill @2 "hello" # fill input
|
|
52
|
-
bb-browser press Enter
|
|
53
|
-
bb-browser screenshot
|
|
52
|
+
npm install -g bb-browser
|
|
54
53
|
```
|
|
55
54
|
|
|
56
|
-
###
|
|
55
|
+
### Chrome Extension
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
1. Download from [Releases](https://github.com/epiral/bb-browser/releases/latest)
|
|
58
|
+
2. Unzip → `chrome://extensions/` → Developer Mode → Load unpacked
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
# Reddit — you're logged in, just fetch
|
|
62
|
-
bb-browser fetch https://www.reddit.com/api/me.json
|
|
63
|
-
|
|
64
|
-
# Any website's internal API — the browser handles auth
|
|
65
|
-
bb-browser fetch https://api.example.com/user/profile --json
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Network Capture
|
|
69
|
-
|
|
70
|
-
See what any website sends and receives — request headers, bodies, response data. Like Chrome DevTools Network tab, but from CLI.
|
|
60
|
+
### Use
|
|
71
61
|
|
|
72
62
|
```bash
|
|
73
|
-
bb-browser
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
bb-browser site update # pull 50+ community adapters
|
|
64
|
+
bb-browser site list # see what's available
|
|
65
|
+
bb-browser site zhihu/hot # go
|
|
76
66
|
```
|
|
77
67
|
|
|
78
|
-
###
|
|
68
|
+
### MCP (Claude Code / Cursor)
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"bb-browser": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "bb-browser", "--mcp"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
## Site Adapters — the core feature
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
bb-browser site update # install adapters
|
|
84
|
-
bb-browser site reddit/thread https://reddit.com/r/... # Reddit discussion tree
|
|
85
|
-
bb-browser site twitter/user yan5xu # Twitter profile
|
|
86
|
-
bb-browser site xiaohongshu/feed # Xiaohongshu feed
|
|
87
|
-
bb-browser site hackernews/top # HN front page
|
|
88
|
-
```
|
|
83
|
+
Community-driven via [bb-sites](https://github.com/epiral/bb-sites). One JS file per command.
|
|
89
84
|
|
|
90
|
-
|
|
85
|
+
| Platform | Commands | Auth |
|
|
86
|
+
|----------|----------|------|
|
|
87
|
+
| **Reddit** | me, posts, thread, context | Cookie |
|
|
88
|
+
| **Twitter/X** | user, thread | Bearer + CSRF |
|
|
89
|
+
| **GitHub** | me, repo, issues, issue-create, pr-create, fork | Cookie |
|
|
90
|
+
| **Hacker News** | top, thread | Public API |
|
|
91
|
+
| **Zhihu** | me, hot, question, search | Cookie |
|
|
92
|
+
| **Bilibili** | me, popular, ranking, search, video, comments, feed, history, trending | Cookie |
|
|
93
|
+
| **Weibo** | me, hot, feed, user, user_posts, post, comments | Cookie |
|
|
94
|
+
| **Douban** | search, movie, movie-hot, movie-top, top250, comments | Cookie |
|
|
95
|
+
| **YouTube** | search, video, comments, channel, feed, transcript | innertube |
|
|
96
|
+
| **Xiaohongshu** | me, feed, search, note, comments, user_posts | Pinia store |
|
|
91
97
|
|
|
92
|
-
|
|
98
|
+
### Create your own
|
|
93
99
|
|
|
94
100
|
```bash
|
|
95
|
-
|
|
101
|
+
bb-browser guide # full tutorial
|
|
96
102
|
```
|
|
97
103
|
|
|
98
|
-
|
|
104
|
+
Tell your AI agent "turn XX website into a CLI" — it reads the guide, reverse-engineers the API with `network --with-body`, writes the adapter, tests it, and submits a PR. All autonomously.
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
2. "Load unpacked" → select `node_modules/bb-browser/extension/`
|
|
102
|
-
3. Done.
|
|
106
|
+
## Also a full browser automation tool
|
|
103
107
|
|
|
104
108
|
```bash
|
|
105
|
-
bb-browser
|
|
106
|
-
bb-browser
|
|
109
|
+
bb-browser open https://example.com
|
|
110
|
+
bb-browser snapshot -i # accessibility tree
|
|
111
|
+
bb-browser click @3 # click element
|
|
112
|
+
bb-browser fill @5 "hello" # fill input
|
|
113
|
+
bb-browser eval "document.title" # run JS
|
|
114
|
+
bb-browser fetch URL --json # authenticated fetch
|
|
115
|
+
bb-browser network requests --with-body --json # capture traffic
|
|
116
|
+
bb-browser screenshot # take screenshot
|
|
107
117
|
```
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| Category | Command | Description |
|
|
112
|
-
|----------|---------|-------------|
|
|
113
|
-
| **Navigate** | `open <url>` | Open URL |
|
|
114
|
-
| | `back` / `forward` / `refresh` | Navigate |
|
|
115
|
-
| | `close` | Close tab |
|
|
116
|
-
| **Snapshot** | `snapshot` | Full DOM tree |
|
|
117
|
-
| | `snapshot -i` | Interactive elements only |
|
|
118
|
-
| **Interact** | `click <ref>` | Click element |
|
|
119
|
-
| | `fill <ref> <text>` | Clear and fill |
|
|
120
|
-
| | `type <ref> <text>` | Append text |
|
|
121
|
-
| | `hover <ref>` | Hover |
|
|
122
|
-
| | `press <key>` | Keyboard (Enter, Tab, Control+a) |
|
|
123
|
-
| | `scroll <dir> [px]` | Scroll |
|
|
124
|
-
| | `check` / `uncheck <ref>` | Checkbox |
|
|
125
|
-
| | `select <ref> <val>` | Dropdown |
|
|
126
|
-
| **Data** | `get text <ref>` | Element text |
|
|
127
|
-
| | `get url` / `get title` | Page info |
|
|
128
|
-
| | `screenshot [path]` | Screenshot |
|
|
129
|
-
| | `eval "<js>"` | Run JavaScript |
|
|
130
|
-
| **Fetch** | `fetch <url> [--json]` | Authenticated HTTP fetch |
|
|
131
|
-
| **Site** | `site list` | List site adapters |
|
|
132
|
-
| | `site <name> [args]` | Run adapter |
|
|
133
|
-
| | `site update` | Update community adapters |
|
|
134
|
-
| **Network** | `network requests [filter]` | View requests |
|
|
135
|
-
| | `network requests --with-body` | Include headers & body |
|
|
136
|
-
| | `network route "<url>" --abort` | Block requests |
|
|
137
|
-
| | `network clear` | Clear records |
|
|
138
|
-
| **Tab** | `tab` | List tabs |
|
|
139
|
-
| | `tab new [url]` | New tab |
|
|
140
|
-
| | `tab <n>` | Switch tab |
|
|
141
|
-
| **Debug** | `console` / `errors` | Console & JS errors |
|
|
142
|
-
| | `trace start` / `trace stop` | Record user actions |
|
|
143
|
-
| **Daemon** | `daemon` / `stop` / `status` | Manage daemon |
|
|
144
|
-
|
|
145
|
-
All commands support `--json` for structured output and `--tab <id>` for multi-tab operations.
|
|
119
|
+
All commands support `--json` output and `--tab <id>` for concurrent multi-tab operations.
|
|
146
120
|
|
|
147
121
|
## Architecture
|
|
148
122
|
|
|
149
123
|
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
│
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
└── extension/ # Built extension (npm publish)
|
|
124
|
+
AI Agent (Claude Code, Codex, Cursor, etc.)
|
|
125
|
+
│ CLI or MCP (stdio)
|
|
126
|
+
▼
|
|
127
|
+
bb-browser CLI ──HTTP──▶ Daemon ──SSE──▶ Chrome Extension
|
|
128
|
+
│
|
|
129
|
+
▼ chrome.debugger (CDP)
|
|
130
|
+
Your Real Browser
|
|
158
131
|
```
|
|
159
132
|
|
|
160
|
-
| Layer | Tech |
|
|
161
|
-
|-------|------|
|
|
162
|
-
| CLI | TypeScript, zero dependencies |
|
|
163
|
-
| Daemon | Node.js HTTP + SSE |
|
|
164
|
-
| Extension | Chrome MV3 + `chrome.debugger` API |
|
|
165
|
-
| Build | pnpm monorepo + Turborepo + tsup + Vite |
|
|
166
|
-
|
|
167
133
|
## License
|
|
168
134
|
|
|
169
135
|
[MIT](LICENSE)
|
package/README.zh-CN.md
CHANGED
|
@@ -16,154 +16,120 @@
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
你已经登录了知乎、微博、B站、豆瓣、小红书、Reddit、Twitter、YouTube — bb-browser 让 AI Agent **直接用你的登录态**。
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
bb-browser
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
```bash
|
|
22
|
+
bb-browser site zhihu/hot # 知乎热榜
|
|
23
|
+
bb-browser site weibo/hot # 微博热搜
|
|
24
|
+
bb-browser site bilibili/popular # B站热门
|
|
25
|
+
bb-browser site douban/top250 # 豆瓣 Top 250
|
|
26
|
+
bb-browser site youtube/transcript VIDEO_ID # YouTube 字幕全文
|
|
27
|
+
bb-browser site reddit/thread URL # Reddit 讨论树
|
|
28
|
+
bb-browser site twitter/user elonmusk # Twitter 用户资料
|
|
29
|
+
bb-browser site xiaohongshu/search 美食 # 小红书搜索
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
**10 个平台,50+ 个命令,全部用你真实浏览器的登录态。** [完整列表 →](https://github.com/epiral/bb-sites)
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
## 为什么它不一样
|
|
35
|
+
|
|
36
|
+
所有浏览器自动化工具都能点按钮、填表单,bb-browser 也能。但真正的杀手锏是 **Site Adapters** — 预置命令把任何网站变成 CLI/API,直接用你的登录态。
|
|
37
|
+
|
|
38
|
+
原理:adapter 在你的浏览器 tab 里跑 `eval`,用你的 Cookie 调 `fetch()`,或者直接调用页面自己的 Vue/Pinia store action。网站以为是你在操作。因为**就是你**。
|
|
35
39
|
|
|
36
40
|
| | Playwright / Selenium | 爬虫库 | bb-browser |
|
|
37
41
|
|---|---|---|---|
|
|
38
42
|
| 浏览器 | 无头、隔离环境 | 没有浏览器 | 你的真实 Chrome |
|
|
39
43
|
| 登录态 | 没有,要重新登录 | 偷 Cookie | 已经在了 |
|
|
40
44
|
| 反爬检测 | 容易被识别 | 猫鼠游戏 | 无法检测 — 它就是用户 |
|
|
41
|
-
|
|
|
45
|
+
| 小红书签名 | 无法复制 | 需要逆向 | 页面自己签名 |
|
|
42
46
|
|
|
43
|
-
##
|
|
47
|
+
## 快速开始
|
|
44
48
|
|
|
45
|
-
###
|
|
49
|
+
### 安装
|
|
46
50
|
|
|
47
51
|
```bash
|
|
48
|
-
bb-browser
|
|
49
|
-
bb-browser snapshot -i # 只看可交互元素
|
|
50
|
-
bb-browser click @0 # 按 ref 点击
|
|
51
|
-
bb-browser fill @2 "hello" # 填写输入框
|
|
52
|
-
bb-browser press Enter
|
|
53
|
-
bb-browser screenshot
|
|
52
|
+
npm install -g bb-browser
|
|
54
53
|
```
|
|
55
54
|
|
|
56
|
-
###
|
|
55
|
+
### Chrome 扩展
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
1. 从 [Releases](https://github.com/epiral/bb-browser/releases/latest) 下载 zip
|
|
58
|
+
2. 解压 → `chrome://extensions/` → 开发者模式 → 加载已解压的扩展程序
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
# Reddit — 你已经登录了,直接 fetch
|
|
62
|
-
bb-browser fetch https://www.reddit.com/api/me.json
|
|
63
|
-
|
|
64
|
-
# 任何网站的内部 API — 浏览器自动处理认证
|
|
65
|
-
bb-browser fetch https://api.example.com/user/profile --json
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 网络抓包
|
|
69
|
-
|
|
70
|
-
查看任何网站发送和接收的完整数据 — 请求头、请求体、响应体。相当于 Chrome DevTools 的 Network 面板,但在命令行里。
|
|
60
|
+
### 使用
|
|
71
61
|
|
|
72
62
|
```bash
|
|
73
|
-
bb-browser
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
bb-browser site update # 拉取 50+ 社区适配器
|
|
64
|
+
bb-browser site list # 看看有什么
|
|
65
|
+
bb-browser site zhihu/hot # 开搞
|
|
76
66
|
```
|
|
77
67
|
|
|
78
|
-
###
|
|
68
|
+
### MCP 接入(Claude Code / Cursor)
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"bb-browser": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "bb-browser", "--mcp"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
## Site Adapters — 核心能力
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
bb-browser site update # 安装/更新 adapter
|
|
84
|
-
bb-browser site reddit/thread https://reddit.com/r/... # Reddit 讨论树
|
|
85
|
-
bb-browser site twitter/user yan5xu # Twitter 用户资料
|
|
86
|
-
bb-browser site xiaohongshu/feed # 小红书推荐 Feed
|
|
87
|
-
bb-browser site hackernews/top # HN 首页
|
|
88
|
-
```
|
|
83
|
+
社区驱动,通过 [bb-sites](https://github.com/epiral/bb-sites) 维护。每个命令一个 JS 文件。
|
|
89
84
|
|
|
90
|
-
|
|
85
|
+
| 平台 | 命令 | 认证方式 |
|
|
86
|
+
|------|------|----------|
|
|
87
|
+
| **知乎** | me, hot, question, search | Cookie |
|
|
88
|
+
| **B站** | me, popular, ranking, search, video, comments, feed, history, trending | Cookie |
|
|
89
|
+
| **微博** | me, hot, feed, user, user_posts, post, comments | Cookie |
|
|
90
|
+
| **豆瓣** | search, movie, movie-hot, movie-top, top250, comments | Cookie |
|
|
91
|
+
| **小红书** | me, feed, search, note, comments, user_posts | Pinia store |
|
|
92
|
+
| **YouTube** | search, video, comments, channel, feed, transcript | innertube |
|
|
93
|
+
| **Reddit** | me, posts, thread, context | Cookie |
|
|
94
|
+
| **Twitter/X** | user, thread | Bearer + CSRF |
|
|
95
|
+
| **GitHub** | me, repo, issues, issue-create, pr-create, fork | Cookie |
|
|
96
|
+
| **Hacker News** | top, thread | 公开 API |
|
|
91
97
|
|
|
92
|
-
|
|
98
|
+
### 自己做一个
|
|
93
99
|
|
|
94
100
|
```bash
|
|
95
|
-
|
|
101
|
+
bb-browser guide # 完整教程
|
|
96
102
|
```
|
|
97
103
|
|
|
98
|
-
|
|
104
|
+
跟你的 AI Agent 说「帮我把 XX 网站 CLI 化」— 它会读 guide,用 `network --with-body` 抓包逆向 API,写 adapter,测试,然后自己提 PR 到社区仓库。全程自动。
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
2. 点击「加载已解压的扩展程序」→ 选 `node_modules/bb-browser/extension/`
|
|
102
|
-
3. 完成。
|
|
106
|
+
## 同时也是完整的浏览器自动化工具
|
|
103
107
|
|
|
104
108
|
```bash
|
|
105
|
-
bb-browser
|
|
106
|
-
bb-browser
|
|
109
|
+
bb-browser open https://example.com
|
|
110
|
+
bb-browser snapshot -i # 可访问性树
|
|
111
|
+
bb-browser click @3 # 点击元素
|
|
112
|
+
bb-browser fill @5 "hello" # 填写输入框
|
|
113
|
+
bb-browser eval "document.title" # 执行 JS
|
|
114
|
+
bb-browser fetch URL --json # 带登录态的 fetch
|
|
115
|
+
bb-browser network requests --with-body --json # 抓包
|
|
116
|
+
bb-browser screenshot # 截图
|
|
107
117
|
```
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| 分类 | 命令 | 说明 |
|
|
112
|
-
|------|------|------|
|
|
113
|
-
| **导航** | `open <url>` | 打开 URL |
|
|
114
|
-
| | `back` / `forward` / `refresh` | 导航 |
|
|
115
|
-
| | `close` | 关闭标签页 |
|
|
116
|
-
| **快照** | `snapshot` | 完整 DOM 树 |
|
|
117
|
-
| | `snapshot -i` | 只看可交互元素 |
|
|
118
|
-
| **交互** | `click <ref>` | 点击 |
|
|
119
|
-
| | `fill <ref> <text>` | 清空后填入 |
|
|
120
|
-
| | `type <ref> <text>` | 追加输入 |
|
|
121
|
-
| | `hover <ref>` | 悬停 |
|
|
122
|
-
| | `press <key>` | 按键(Enter, Tab, Control+a)|
|
|
123
|
-
| | `scroll <dir> [px]` | 滚动 |
|
|
124
|
-
| | `check` / `uncheck <ref>` | 复选框 |
|
|
125
|
-
| | `select <ref> <val>` | 下拉框 |
|
|
126
|
-
| **数据** | `get text <ref>` | 元素文本 |
|
|
127
|
-
| | `get url` / `get title` | 页面信息 |
|
|
128
|
-
| | `screenshot [path]` | 截图 |
|
|
129
|
-
| | `eval "<js>"` | 执行 JavaScript |
|
|
130
|
-
| **Fetch** | `fetch <url> [--json]` | 带登录态的 HTTP 请求 |
|
|
131
|
-
| **Site** | `site list` | 列出 adapter |
|
|
132
|
-
| | `site <name> [args]` | 运行 adapter |
|
|
133
|
-
| | `site update` | 更新社区 adapter |
|
|
134
|
-
| **网络** | `network requests [filter]` | 查看请求 |
|
|
135
|
-
| | `network requests --with-body` | 包含请求头和响应体 |
|
|
136
|
-
| | `network route "<url>" --abort` | 拦截请求 |
|
|
137
|
-
| | `network clear` | 清空记录 |
|
|
138
|
-
| **Tab** | `tab` | 列出标签页 |
|
|
139
|
-
| | `tab new [url]` | 新标签页 |
|
|
140
|
-
| | `tab <n>` | 切换标签页 |
|
|
141
|
-
| **调试** | `console` / `errors` | 控制台/JS 错误 |
|
|
142
|
-
| | `trace start` / `trace stop` | 录制用户操作 |
|
|
143
|
-
| **Daemon** | `daemon` / `stop` / `status` | 管理 daemon |
|
|
144
|
-
|
|
145
|
-
所有命令支持 `--json` 结构化输出和 `--tab <id>` 多标签页操作。
|
|
119
|
+
所有命令支持 `--json` 输出和 `--tab <id>` 多标签页并发操作。
|
|
146
120
|
|
|
147
121
|
## 架构
|
|
148
122
|
|
|
149
123
|
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
│
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
└── extension/ # 构建好的扩展(npm 发布)
|
|
124
|
+
AI Agent (Claude Code, Codex, Cursor 等)
|
|
125
|
+
│ CLI 或 MCP (stdio)
|
|
126
|
+
▼
|
|
127
|
+
bb-browser CLI ──HTTP──▶ Daemon ──SSE──▶ Chrome 扩展
|
|
128
|
+
│
|
|
129
|
+
▼ chrome.debugger (CDP)
|
|
130
|
+
你的真实浏览器
|
|
158
131
|
```
|
|
159
132
|
|
|
160
|
-
| 层 | 技术栈 |
|
|
161
|
-
|----|--------|
|
|
162
|
-
| CLI | TypeScript,零依赖 |
|
|
163
|
-
| Daemon | Node.js HTTP + SSE |
|
|
164
|
-
| Extension | Chrome MV3 + `chrome.debugger` API |
|
|
165
|
-
| 构建 | pnpm monorepo + Turborepo + tsup + Vite |
|
|
166
|
-
|
|
167
133
|
## 许可证
|
|
168
134
|
|
|
169
135
|
[MIT](LICENSE)
|
package/dist/cli.js
CHANGED
|
@@ -1930,10 +1930,9 @@ async function siteCommand(args, options = {}) {
|
|
|
1930
1930
|
bb-browser site twitter/user yan5xu
|
|
1931
1931
|
bb-browser site search reddit
|
|
1932
1932
|
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
\u8D21\u732E\u65B0 adapter: https://github.com/epiral/bb-sites`);
|
|
1933
|
+
\u521B\u5EFA\u65B0 adapter: bb-browser guide
|
|
1934
|
+
\u62A5\u544A\u95EE\u9898: gh issue create --repo epiral/bb-sites --title "[adapter-name] \u63CF\u8FF0"
|
|
1935
|
+
\u8D21\u732E\u793E\u533A: https://github.com/epiral/bb-sites`);
|
|
1937
1936
|
return;
|
|
1938
1937
|
}
|
|
1939
1938
|
switch (subCommand) {
|
|
@@ -1981,84 +1980,79 @@ bb-browser - AI Agent \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DE5\u5177
|
|
|
1981
1980
|
\u7528\u6CD5\uFF1A
|
|
1982
1981
|
bb-browser <command> [options]
|
|
1983
1982
|
|
|
1984
|
-
\u547D\u4EE4\uFF1A
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
dialog
|
|
1983
|
+
\u7F51\u7AD9 CLI \u5316\uFF08\u628A\u4EFB\u4F55\u7F51\u7AD9\u53D8\u6210\u547D\u4EE4\u884C API\uFF09\uFF1A
|
|
1984
|
+
site list \u5217\u51FA\u6240\u6709\u53EF\u7528 adapter\uFF0850+\uFF09
|
|
1985
|
+
site search <q> \u641C\u7D22 adapter
|
|
1986
|
+
site <name> [args] \u8FD0\u884C adapter\uFF08\u5982 site reddit/thread <url>\uFF09
|
|
1987
|
+
site update \u66F4\u65B0\u793E\u533A adapter \u5E93
|
|
1988
|
+
guide \u5982\u4F55\u521B\u5EFA\u65B0 adapter\uFF08\u5F00\u53D1\u6307\u5357\uFF09
|
|
1989
|
+
|
|
1990
|
+
\u793A\u4F8B\uFF1A
|
|
1991
|
+
bb-browser site twitter/search "claude code"
|
|
1992
|
+
bb-browser site reddit/thread <url>
|
|
1993
|
+
bb-browser site github/pr-create owner/repo --title "feat: ..."
|
|
1994
|
+
|
|
1995
|
+
\u9875\u9762\u5BFC\u822A\uFF1A
|
|
1996
|
+
open <url> [--tab] \u6253\u5F00\u6307\u5B9A URL\uFF08\u9ED8\u8BA4\u65B0 tab\uFF0C--tab current \u5F53\u524D tab\uFF09
|
|
1997
|
+
back / forward \u540E\u9000 / \u524D\u8FDB
|
|
1998
|
+
refresh \u5237\u65B0\u9875\u9762
|
|
1999
|
+
close \u5173\u95ED\u5F53\u524D\u6807\u7B7E\u9875
|
|
2000
|
+
tab \u5217\u51FA\u6240\u6709\u6807\u7B7E\u9875
|
|
2001
|
+
tab new [url] \u65B0\u5EFA\u6807\u7B7E\u9875
|
|
2002
|
+
tab <n> \u5207\u6362\u5230\u7B2C n \u4E2A\u6807\u7B7E\u9875\uFF08\u6309 index\uFF09
|
|
2003
|
+
tab select --id <id> \u5207\u6362\u5230\u6307\u5B9A tabId \u7684\u6807\u7B7E\u9875
|
|
2004
|
+
tab close [n|--id <id>] \u5173\u95ED\u6807\u7B7E\u9875
|
|
2005
|
+
frame <selector> \u5207\u6362\u5230\u6307\u5B9A iframe
|
|
2006
|
+
frame main \u8FD4\u56DE\u4E3B frame
|
|
2007
|
+
wait <ms|@ref> \u7B49\u5F85\u65F6\u95F4\u6216\u5143\u7D20
|
|
2008
|
+
|
|
2009
|
+
\u9875\u9762\u4EA4\u4E92\uFF1A
|
|
2010
|
+
click <ref> \u70B9\u51FB\u5143\u7D20\uFF08ref \u5982 @5 \u6216 5\uFF09
|
|
2011
|
+
hover <ref> \u60AC\u505C\u5728\u5143\u7D20\u4E0A
|
|
2012
|
+
fill <ref> <text> \u586B\u5145\u8F93\u5165\u6846\uFF08\u6E05\u7A7A\u540E\u586B\u5165\uFF09
|
|
2013
|
+
type <ref> <text> \u9010\u5B57\u7B26\u8F93\u5165\uFF08\u4E0D\u6E05\u7A7A\uFF09
|
|
2014
|
+
check <ref> \u52FE\u9009\u590D\u9009\u6846
|
|
2015
|
+
uncheck <ref> \u53D6\u6D88\u52FE\u9009\u590D\u9009\u6846
|
|
2016
|
+
select <ref> <val> \u4E0B\u62C9\u6846\u9009\u62E9
|
|
2017
|
+
press <key> \u53D1\u9001\u952E\u76D8\u6309\u952E\uFF08\u5982 Enter, Tab, Control+a\uFF09
|
|
2018
|
+
scroll <dir> [px] \u6EDA\u52A8\u9875\u9762\uFF08up/down/left/right\uFF0C\u9ED8\u8BA4 300px\uFF09
|
|
2019
|
+
dialog accept [text] \u63A5\u53D7\u5BF9\u8BDD\u6846
|
|
2020
|
+
dialog dismiss \u62D2\u7EDD/\u5173\u95ED\u5BF9\u8BDD\u6846
|
|
2021
|
+
|
|
2022
|
+
\u9875\u9762\u4FE1\u606F\uFF1A
|
|
2023
|
+
snapshot \u83B7\u53D6\u5F53\u524D\u9875\u9762\u5FEB\u7167\uFF08\u9ED8\u8BA4\u5B8C\u6574\u6811\uFF09
|
|
2024
|
+
get text <ref> \u83B7\u53D6\u5143\u7D20\u6587\u672C
|
|
2025
|
+
get url \u83B7\u53D6\u5F53\u524D\u9875\u9762 URL
|
|
2026
|
+
get title \u83B7\u53D6\u9875\u9762\u6807\u9898
|
|
2027
|
+
screenshot [path] \u622A\u53D6\u5F53\u524D\u9875\u9762
|
|
2028
|
+
eval "<js>" \u6267\u884C JavaScript
|
|
2029
|
+
fetch <url> \u5728\u6D4F\u89C8\u5668\u4E0A\u4E0B\u6587\u4E2D fetch\uFF08\u81EA\u52A8\u540C\u6E90\u8DEF\u7531\uFF0C\u5E26\u767B\u5F55\u6001\uFF09
|
|
2030
|
+
|
|
2031
|
+
\u7F51\u7EDC\u4E0E\u8C03\u8BD5\uFF1A
|
|
2021
2032
|
network requests [filter] \u67E5\u770B\u7F51\u7EDC\u8BF7\u6C42
|
|
2022
2033
|
network route <url> [--abort|--body <json>] \u62E6\u622A\u8BF7\u6C42
|
|
2023
|
-
network unroute [url]
|
|
2024
|
-
network clear
|
|
2025
|
-
console
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
site list \u5217\u51FA\u6240\u6709\u53EF\u7528 adapter
|
|
2035
|
-
site search <q> \u641C\u7D22 adapter
|
|
2036
|
-
site <name> \u8FD0\u884C adapter\uFF08\u5982 site reddit/thread <url>\uFF09
|
|
2037
|
-
site update \u66F4\u65B0\u793E\u533A adapter \u5E93
|
|
2034
|
+
network unroute [url] \u79FB\u9664\u62E6\u622A\u89C4\u5219
|
|
2035
|
+
network clear \u6E05\u7A7A\u8BF7\u6C42\u8BB0\u5F55
|
|
2036
|
+
console [--clear] \u67E5\u770B/\u6E05\u7A7A\u63A7\u5236\u53F0\u6D88\u606F
|
|
2037
|
+
errors [--clear] \u67E5\u770B/\u6E05\u7A7A JS \u9519\u8BEF
|
|
2038
|
+
trace start|stop|status \u5F55\u5236\u7528\u6237\u64CD\u4F5C
|
|
2039
|
+
|
|
2040
|
+
Daemon \u7BA1\u7406\uFF1A
|
|
2041
|
+
daemon / start \u524D\u53F0\u542F\u52A8 Daemon
|
|
2042
|
+
stop \u505C\u6B62 Daemon
|
|
2043
|
+
status \u67E5\u770B Daemon \u72B6\u6001
|
|
2044
|
+
reload \u91CD\u8F7D\u6269\u5C55\uFF08\u9700\u8981 CDP \u6A21\u5F0F\uFF09
|
|
2038
2045
|
|
|
2039
2046
|
\u9009\u9879\uFF1A
|
|
2040
|
-
--json
|
|
2041
|
-
-i, --interactive
|
|
2042
|
-
-c, --compact
|
|
2043
|
-
-d, --depth <n>
|
|
2047
|
+
--json \u4EE5 JSON \u683C\u5F0F\u8F93\u51FA
|
|
2048
|
+
-i, --interactive \u53EA\u8F93\u51FA\u53EF\u4EA4\u4E92\u5143\u7D20\uFF08snapshot \u547D\u4EE4\uFF09
|
|
2049
|
+
-c, --compact \u79FB\u9664\u7A7A\u7ED3\u6784\u8282\u70B9\uFF08snapshot \u547D\u4EE4\uFF09
|
|
2050
|
+
-d, --depth <n> \u9650\u5236\u6811\u6DF1\u5EA6\uFF08snapshot \u547D\u4EE4\uFF09
|
|
2044
2051
|
-s, --selector <sel> \u9650\u5B9A CSS \u9009\u62E9\u5668\u8303\u56F4\uFF08snapshot \u547D\u4EE4\uFF09
|
|
2045
|
-
--tab <tabId>
|
|
2046
|
-
--mcp
|
|
2047
|
-
--help, -h
|
|
2048
|
-
--version, -v
|
|
2049
|
-
|
|
2050
|
-
\u793A\u4F8B\uFF1A
|
|
2051
|
-
bb-browser open https://example.com
|
|
2052
|
-
bb-browser snapshot --json
|
|
2053
|
-
bb-browser click @5
|
|
2054
|
-
bb-browser fill @3 "hello world"
|
|
2055
|
-
bb-browser type @3 "append text"
|
|
2056
|
-
bb-browser get text @5
|
|
2057
|
-
bb-browser get url
|
|
2058
|
-
bb-browser press Enter
|
|
2059
|
-
bb-browser press Control+a
|
|
2060
|
-
bb-browser daemon
|
|
2061
|
-
bb-browser stop
|
|
2052
|
+
--tab <tabId> \u6307\u5B9A\u64CD\u4F5C\u7684\u6807\u7B7E\u9875 ID
|
|
2053
|
+
--mcp \u542F\u52A8 MCP server\uFF08\u7528\u4E8E Claude Code / Cursor \u7B49 AI \u5DE5\u5177\uFF09
|
|
2054
|
+
--help, -h \u663E\u793A\u5E2E\u52A9\u4FE1\u606F
|
|
2055
|
+
--version, -v \u663E\u793A\u7248\u672C\u53F7
|
|
2062
2056
|
`.trim();
|
|
2063
2057
|
function parseArgs(argv) {
|
|
2064
2058
|
const args = argv.slice(2);
|