@jackwener/opencli 1.3.1 → 1.3.3
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/CHANGELOG.md +128 -0
- package/README.md +48 -9
- package/README.zh-CN.md +48 -9
- package/SKILL.md +317 -6
- package/TESTING.md +4 -4
- package/dist/browser/cdp.js +10 -1
- package/dist/browser/daemon-client.js +2 -1
- package/dist/browser/discover.js +2 -1
- package/dist/browser/errors.d.ts +2 -1
- package/dist/browser/errors.js +10 -10
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.js +1 -0
- package/dist/browser/page.js +12 -0
- package/dist/browser/stealth.d.ts +18 -0
- package/dist/browser/stealth.js +140 -0
- package/dist/browser.test.js +47 -1
- package/dist/build-manifest.js +1 -3
- package/dist/cli-manifest.json +2573 -989
- package/dist/cli.js +42 -2
- package/dist/clis/bilibili/download.js +20 -65
- package/dist/clis/bilibili/utils.js +2 -1
- package/dist/clis/chaoxing/assignments.js +2 -1
- package/dist/clis/doubao/ask.d.ts +1 -0
- package/dist/clis/doubao/ask.js +35 -0
- package/dist/clis/doubao/common.d.ts +23 -0
- package/dist/clis/doubao/common.js +564 -0
- package/dist/clis/doubao/new.d.ts +1 -0
- package/dist/clis/doubao/new.js +20 -0
- package/dist/clis/doubao/read.d.ts +1 -0
- package/dist/clis/doubao/read.js +19 -0
- package/dist/clis/doubao/send.d.ts +1 -0
- package/dist/clis/doubao/send.js +22 -0
- package/dist/clis/doubao/status.d.ts +1 -0
- package/dist/clis/doubao/status.js +24 -0
- package/dist/clis/doubao-app/ask.d.ts +1 -0
- package/dist/clis/doubao-app/ask.js +53 -0
- package/dist/clis/doubao-app/common.d.ts +37 -0
- package/dist/clis/doubao-app/common.js +110 -0
- package/dist/clis/doubao-app/dump.d.ts +1 -0
- package/dist/clis/doubao-app/dump.js +24 -0
- package/dist/clis/doubao-app/new.d.ts +1 -0
- package/dist/clis/doubao-app/new.js +20 -0
- package/dist/clis/doubao-app/read.d.ts +1 -0
- package/dist/clis/doubao-app/read.js +18 -0
- package/dist/clis/doubao-app/screenshot.d.ts +1 -0
- package/dist/clis/doubao-app/screenshot.js +18 -0
- package/dist/clis/doubao-app/send.d.ts +1 -0
- package/dist/clis/doubao-app/send.js +27 -0
- package/dist/clis/doubao-app/status.d.ts +1 -0
- package/dist/clis/doubao-app/status.js +16 -0
- package/dist/clis/hackernews/ask.yaml +38 -0
- package/dist/clis/hackernews/best.yaml +38 -0
- package/dist/clis/hackernews/jobs.yaml +36 -0
- package/dist/clis/hackernews/new.yaml +38 -0
- package/dist/clis/hackernews/search.yaml +44 -0
- package/dist/clis/hackernews/show.yaml +38 -0
- package/dist/clis/hackernews/top.yaml +3 -1
- package/dist/clis/hackernews/user.yaml +25 -0
- package/dist/clis/twitter/download.js +13 -97
- package/dist/clis/twitter/thread.js +2 -1
- package/dist/clis/v2ex/member.yaml +29 -0
- package/dist/clis/v2ex/node.yaml +34 -0
- package/dist/clis/v2ex/nodes.yaml +31 -0
- package/dist/clis/v2ex/replies.yaml +32 -0
- package/dist/clis/v2ex/user.yaml +34 -0
- package/dist/clis/weibo/search.d.ts +1 -0
- package/dist/clis/weibo/search.js +73 -0
- package/dist/clis/weixin/download.d.ts +12 -0
- package/dist/clis/weixin/download.js +183 -0
- package/dist/clis/xiaohongshu/download.js +12 -60
- package/dist/clis/xiaohongshu/publish.d.ts +18 -0
- package/dist/clis/xiaohongshu/publish.js +352 -0
- package/dist/clis/xiaohongshu/search.js +47 -15
- package/dist/clis/xiaohongshu/search.test.d.ts +1 -0
- package/dist/clis/xiaohongshu/search.test.js +114 -0
- package/dist/clis/yollomi/background.d.ts +4 -0
- package/dist/clis/yollomi/background.js +45 -0
- package/dist/clis/yollomi/edit.d.ts +5 -0
- package/dist/clis/yollomi/edit.js +56 -0
- package/dist/clis/yollomi/face-swap.d.ts +5 -0
- package/dist/clis/yollomi/face-swap.js +43 -0
- package/dist/clis/yollomi/generate.d.ts +9 -0
- package/dist/clis/yollomi/generate.js +100 -0
- package/dist/clis/yollomi/models.d.ts +1 -0
- package/dist/clis/yollomi/models.js +33 -0
- package/dist/clis/yollomi/object-remover.d.ts +4 -0
- package/dist/clis/yollomi/object-remover.js +42 -0
- package/dist/clis/yollomi/remove-bg.d.ts +4 -0
- package/dist/clis/yollomi/remove-bg.js +38 -0
- package/dist/clis/yollomi/restore.d.ts +4 -0
- package/dist/clis/yollomi/restore.js +38 -0
- package/dist/clis/yollomi/try-on.d.ts +4 -0
- package/dist/clis/yollomi/try-on.js +46 -0
- package/dist/clis/yollomi/upload.d.ts +7 -0
- package/dist/clis/yollomi/upload.js +71 -0
- package/dist/clis/yollomi/upscale.d.ts +4 -0
- package/dist/clis/yollomi/upscale.js +53 -0
- package/dist/clis/yollomi/utils.d.ts +45 -0
- package/dist/clis/yollomi/utils.js +180 -0
- package/dist/clis/yollomi/video.d.ts +5 -0
- package/dist/clis/yollomi/video.js +56 -0
- package/dist/clis/zhihu/download.d.ts +1 -5
- package/dist/clis/zhihu/download.js +20 -126
- package/dist/clis/zhihu/download.test.js +7 -5
- package/dist/clis/zhihu/question.js +2 -1
- package/dist/commanderAdapter.js +4 -6
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/daemon.js +7 -3
- package/dist/discovery.js +10 -10
- package/dist/doctor.js +2 -1
- package/dist/download/article-download.d.ts +59 -0
- package/dist/download/article-download.js +178 -0
- package/dist/download/media-download.d.ts +49 -0
- package/dist/download/media-download.js +112 -0
- package/dist/errors.d.ts +23 -2
- package/dist/errors.js +58 -2
- package/dist/errors.test.d.ts +1 -0
- package/dist/errors.test.js +59 -0
- package/dist/execution.js +9 -10
- package/dist/explore.js +4 -2
- package/dist/external.d.ts +15 -0
- package/dist/external.js +48 -2
- package/dist/external.test.d.ts +1 -0
- package/dist/external.test.js +64 -0
- package/dist/main.js +10 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.js +45 -23
- package/dist/plugin.test.js +6 -1
- package/dist/record.d.ts +47 -0
- package/dist/record.js +545 -0
- package/dist/registry.d.ts +7 -2
- package/dist/registry.js +2 -6
- package/dist/runtime.d.ts +3 -1
- package/dist/runtime.js +10 -3
- package/dist/validate.js +1 -3
- package/docs/.vitepress/config.mts +1 -0
- package/docs/adapters/browser/douban.md +18 -8
- package/docs/adapters/browser/doubao.md +35 -0
- package/docs/adapters/browser/hackernews.md +20 -4
- package/docs/adapters/browser/tiktok.md +1 -1
- package/docs/adapters/browser/v2ex.md +31 -10
- package/docs/adapters/browser/weibo.md +4 -0
- package/docs/adapters/browser/weixin.md +33 -0
- package/docs/adapters/browser/wikipedia.md +0 -9
- package/docs/adapters/browser/xiaohongshu.md +8 -6
- package/docs/adapters/browser/yollomi.md +69 -0
- package/docs/adapters/desktop/antigravity.md +0 -3
- package/docs/adapters/desktop/doubao-app.md +35 -0
- package/docs/adapters/index.md +19 -8
- package/docs/advanced/download.md +4 -0
- package/package.json +3 -1
- package/src/browser/cdp.ts +9 -1
- package/src/browser/daemon-client.ts +4 -3
- package/src/browser/discover.ts +2 -1
- package/src/browser/errors.ts +18 -11
- package/src/browser/index.ts +1 -0
- package/src/browser/page.ts +11 -0
- package/src/browser/stealth.ts +142 -0
- package/src/browser.test.ts +51 -1
- package/src/build-manifest.ts +1 -3
- package/src/cli.ts +45 -2
- package/src/clis/bilibili/download.ts +25 -83
- package/src/clis/bilibili/utils.ts +2 -1
- package/src/clis/chaoxing/assignments.ts +2 -1
- package/src/clis/doubao/ask.ts +40 -0
- package/src/clis/doubao/common.ts +619 -0
- package/src/clis/doubao/new.ts +22 -0
- package/src/clis/doubao/read.ts +20 -0
- package/src/clis/doubao/send.ts +25 -0
- package/src/clis/doubao/status.ts +27 -0
- package/src/clis/doubao-app/ask.ts +60 -0
- package/src/clis/doubao-app/common.ts +116 -0
- package/src/clis/doubao-app/dump.ts +28 -0
- package/src/clis/doubao-app/new.ts +21 -0
- package/src/clis/doubao-app/read.ts +21 -0
- package/src/clis/doubao-app/screenshot.ts +19 -0
- package/src/clis/doubao-app/send.ts +30 -0
- package/src/clis/doubao-app/status.ts +17 -0
- package/src/clis/hackernews/ask.yaml +38 -0
- package/src/clis/hackernews/best.yaml +38 -0
- package/src/clis/hackernews/jobs.yaml +36 -0
- package/src/clis/hackernews/new.yaml +38 -0
- package/src/clis/hackernews/search.yaml +44 -0
- package/src/clis/hackernews/show.yaml +38 -0
- package/src/clis/hackernews/top.yaml +3 -1
- package/src/clis/hackernews/user.yaml +25 -0
- package/src/clis/twitter/download.ts +13 -111
- package/src/clis/twitter/thread.ts +2 -1
- package/src/clis/v2ex/member.yaml +29 -0
- package/src/clis/v2ex/node.yaml +34 -0
- package/src/clis/v2ex/nodes.yaml +31 -0
- package/src/clis/v2ex/replies.yaml +32 -0
- package/src/clis/v2ex/user.yaml +34 -0
- package/src/clis/weibo/search.ts +78 -0
- package/src/clis/weixin/download.ts +199 -0
- package/src/clis/xiaohongshu/download.ts +12 -71
- package/src/clis/xiaohongshu/publish.ts +392 -0
- package/src/clis/xiaohongshu/search.test.ts +134 -0
- package/src/clis/xiaohongshu/search.ts +49 -15
- package/src/clis/yollomi/background.ts +48 -0
- package/src/clis/yollomi/edit.ts +58 -0
- package/src/clis/yollomi/face-swap.ts +45 -0
- package/src/clis/yollomi/generate.ts +95 -0
- package/src/clis/yollomi/models.ts +38 -0
- package/src/clis/yollomi/object-remover.ts +44 -0
- package/src/clis/yollomi/remove-bg.ts +40 -0
- package/src/clis/yollomi/restore.ts +40 -0
- package/src/clis/yollomi/try-on.ts +48 -0
- package/src/clis/yollomi/upload.ts +78 -0
- package/src/clis/yollomi/upscale.ts +49 -0
- package/src/clis/yollomi/utils.ts +202 -0
- package/src/clis/yollomi/video.ts +61 -0
- package/src/clis/zhihu/download.test.ts +7 -5
- package/src/clis/zhihu/download.ts +23 -158
- package/src/clis/zhihu/question.ts +2 -1
- package/src/commanderAdapter.ts +4 -7
- package/src/constants.ts +3 -0
- package/src/daemon.ts +7 -3
- package/src/discovery.ts +26 -26
- package/src/doctor.ts +2 -1
- package/src/download/article-download.ts +272 -0
- package/src/download/media-download.ts +178 -0
- package/src/errors.test.ts +79 -0
- package/src/errors.ts +92 -2
- package/src/execution.ts +14 -10
- package/src/explore.ts +4 -2
- package/src/external.test.ts +88 -0
- package/src/external.ts +56 -2
- package/src/generate.ts +2 -1
- package/src/main.ts +10 -0
- package/src/plugin.test.ts +7 -1
- package/src/plugin.ts +49 -25
- package/src/record.ts +617 -0
- package/src/registry.ts +9 -5
- package/src/runtime.ts +16 -4
- package/src/validate.ts +1 -3
- package/tests/e2e/browser-auth.test.ts +10 -1
- package/tests/e2e/browser-public.test.ts +13 -8
- package/tests/e2e/public-commands.test.ts +209 -21
- package/tests/smoke/api-health.test.ts +65 -6
|
@@ -6,19 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
| Command | Description |
|
|
8
8
|
|---------|-------------|
|
|
9
|
+
| `opencli douban search` | 搜索豆瓣电影、图书或音乐 |
|
|
10
|
+
| `opencli douban top250` | 豆瓣电影 Top 250 |
|
|
11
|
+
| `opencli douban subject` | 条目详情 |
|
|
12
|
+
| `opencli douban marks` | 我的标记 |
|
|
13
|
+
| `opencli douban reviews` | 我的短评 |
|
|
9
14
|
| `opencli douban movie-hot` | 豆瓣电影热门榜单 |
|
|
10
15
|
| `opencli douban book-hot` | 豆瓣图书热门榜单 |
|
|
11
|
-
| `opencli douban search` | 搜索豆瓣电影、图书或音乐 |
|
|
12
16
|
|
|
13
17
|
## Usage Examples
|
|
14
18
|
|
|
15
19
|
```bash
|
|
16
|
-
# 电影热门
|
|
17
|
-
opencli douban movie-hot --limit 10
|
|
18
|
-
|
|
19
|
-
# 图书热门
|
|
20
|
-
opencli douban book-hot --limit 10
|
|
21
|
-
|
|
22
20
|
# 搜索电影
|
|
23
21
|
opencli douban search "流浪地球"
|
|
24
22
|
|
|
@@ -28,8 +26,20 @@ opencli douban search --type book "三体"
|
|
|
28
26
|
# 搜索音乐
|
|
29
27
|
opencli douban search --type music "周杰伦"
|
|
30
28
|
|
|
29
|
+
# 电影 Top 250
|
|
30
|
+
opencli douban top250 --limit 10
|
|
31
|
+
|
|
32
|
+
# 条目详情
|
|
33
|
+
opencli douban subject 1292052
|
|
34
|
+
|
|
35
|
+
# 电影热门
|
|
36
|
+
opencli douban movie-hot --limit 10
|
|
37
|
+
|
|
38
|
+
# 图书热门
|
|
39
|
+
opencli douban book-hot --limit 10
|
|
40
|
+
|
|
31
41
|
# JSON output
|
|
32
|
-
opencli douban
|
|
42
|
+
opencli douban top250 -f json
|
|
33
43
|
```
|
|
34
44
|
|
|
35
45
|
## Prerequisites
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# doubao
|
|
2
|
+
|
|
3
|
+
Browser adapter for [Doubao Chat](https://www.doubao.com/chat).
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
| Command | Description |
|
|
8
|
+
|---------|-------------|
|
|
9
|
+
| `opencli doubao status` | Check whether the page is reachable and whether Doubao appears logged in |
|
|
10
|
+
| `opencli doubao new` | Start a new Doubao conversation |
|
|
11
|
+
| `opencli doubao send "..."` | Send a message to the current Doubao chat |
|
|
12
|
+
| `opencli doubao read` | Read the visible Doubao conversation |
|
|
13
|
+
| `opencli doubao ask "..."` | Send a prompt and wait for a reply |
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- Chrome is running
|
|
18
|
+
- You are already logged into [doubao.com](https://www.doubao.com/)
|
|
19
|
+
- Playwright MCP Bridge / browser bridge is configured for OpenCLI
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
opencli doubao status
|
|
25
|
+
opencli doubao new
|
|
26
|
+
opencli doubao send "帮我总结这段文档"
|
|
27
|
+
opencli doubao read
|
|
28
|
+
opencli doubao ask "请写一个 Python 快速排序示例" --timeout 90
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Notes
|
|
32
|
+
|
|
33
|
+
- The adapter targets the web chat page at `https://www.doubao.com/chat`
|
|
34
|
+
- `new` first tries the visible "New Chat / 新对话" button, then falls back to the new-thread route
|
|
35
|
+
- `ask` uses DOM polling, so very long generations may need a larger `--timeout`
|
|
@@ -6,19 +6,35 @@
|
|
|
6
6
|
|
|
7
7
|
| Command | Description |
|
|
8
8
|
|---------|-------------|
|
|
9
|
-
| `opencli hackernews top` | |
|
|
9
|
+
| `opencli hackernews top` | Hacker News top stories |
|
|
10
|
+
| `opencli hackernews new` | Hacker News newest stories |
|
|
11
|
+
| `opencli hackernews best` | Hacker News best stories |
|
|
12
|
+
| `opencli hackernews ask` | Hacker News Ask HN posts |
|
|
13
|
+
| `opencli hackernews show` | Hacker News Show HN posts |
|
|
14
|
+
| `opencli hackernews jobs` | Hacker News job postings |
|
|
15
|
+
| `opencli hackernews search <query>` | Search Hacker News stories |
|
|
16
|
+
| `opencli hackernews user <username>` | Hacker News user profile |
|
|
10
17
|
|
|
11
18
|
## Usage Examples
|
|
12
19
|
|
|
13
20
|
```bash
|
|
14
|
-
#
|
|
21
|
+
# Top stories
|
|
15
22
|
opencli hackernews top --limit 5
|
|
16
23
|
|
|
24
|
+
# Newest stories
|
|
25
|
+
opencli hackernews new --limit 10
|
|
26
|
+
|
|
27
|
+
# Search stories
|
|
28
|
+
opencli hackernews search "machine learning" --limit 5
|
|
29
|
+
|
|
30
|
+
# User profile
|
|
31
|
+
opencli hackernews user pg
|
|
32
|
+
|
|
17
33
|
# JSON output
|
|
18
34
|
opencli hackernews top -f json
|
|
19
35
|
|
|
20
|
-
#
|
|
21
|
-
opencli hackernews
|
|
36
|
+
# Sort search by date
|
|
37
|
+
opencli hackernews search "rust" --sort date
|
|
22
38
|
```
|
|
23
39
|
|
|
24
40
|
## Prerequisites
|
|
@@ -6,27 +6,48 @@
|
|
|
6
6
|
|
|
7
7
|
| Command | Description |
|
|
8
8
|
|---------|-------------|
|
|
9
|
-
| `opencli v2ex hot` | |
|
|
10
|
-
| `opencli v2ex latest` | |
|
|
11
|
-
| `opencli v2ex topic
|
|
12
|
-
| `opencli v2ex
|
|
13
|
-
| `opencli v2ex
|
|
14
|
-
| `opencli v2ex
|
|
9
|
+
| `opencli v2ex hot` | Hot topics |
|
|
10
|
+
| `opencli v2ex latest` | Latest topics |
|
|
11
|
+
| `opencli v2ex topic <id>` | Topic detail |
|
|
12
|
+
| `opencli v2ex node <name>` | Topics by node |
|
|
13
|
+
| `opencli v2ex user <username>` | Topics by user |
|
|
14
|
+
| `opencli v2ex member <username>` | User profile |
|
|
15
|
+
| `opencli v2ex replies <id>` | Topic replies |
|
|
16
|
+
| `opencli v2ex nodes` | All nodes (sorted by topic count) |
|
|
17
|
+
| `opencli v2ex daily` | Daily hot |
|
|
18
|
+
| `opencli v2ex me` | My profile (auth required) |
|
|
19
|
+
| `opencli v2ex notifications` | My notifications (auth required) |
|
|
15
20
|
|
|
16
21
|
## Usage Examples
|
|
17
22
|
|
|
18
23
|
```bash
|
|
19
|
-
#
|
|
24
|
+
# Hot topics
|
|
20
25
|
opencli v2ex hot --limit 5
|
|
21
26
|
|
|
27
|
+
# Browse topics in a node
|
|
28
|
+
opencli v2ex node python
|
|
29
|
+
|
|
30
|
+
# View topic replies
|
|
31
|
+
opencli v2ex replies 1000
|
|
32
|
+
|
|
33
|
+
# User's topics
|
|
34
|
+
opencli v2ex user Livid
|
|
35
|
+
|
|
36
|
+
# User profile
|
|
37
|
+
opencli v2ex member Livid
|
|
38
|
+
|
|
39
|
+
# List all nodes
|
|
40
|
+
opencli v2ex nodes --limit 10
|
|
41
|
+
|
|
22
42
|
# JSON output
|
|
23
43
|
opencli v2ex hot -f json
|
|
24
|
-
|
|
25
|
-
# Verbose mode
|
|
26
|
-
opencli v2ex hot -v
|
|
27
44
|
```
|
|
28
45
|
|
|
29
46
|
## Prerequisites
|
|
30
47
|
|
|
48
|
+
Most commands (`hot`, `latest`, `topic`, `node`, `user`, `member`, `replies`, `nodes`) use the public V2EX API and **require no browser or login**.
|
|
49
|
+
|
|
50
|
+
For `daily`, `me`, and `notifications`:
|
|
51
|
+
|
|
31
52
|
- Chrome running and **logged into** v2ex.com
|
|
32
53
|
- [Browser Bridge extension](/guide/browser-bridge) installed
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
| Command | Description |
|
|
8
8
|
|---------|-------------|
|
|
9
9
|
| `opencli weibo hot` | |
|
|
10
|
+
| `opencli weibo search` | Search Weibo posts by keyword |
|
|
10
11
|
|
|
11
12
|
## Usage Examples
|
|
12
13
|
|
|
@@ -17,6 +18,9 @@ opencli weibo hot --limit 5
|
|
|
17
18
|
# JSON output
|
|
18
19
|
opencli weibo hot -f json
|
|
19
20
|
|
|
21
|
+
# Search
|
|
22
|
+
opencli weibo search "OpenAI" --limit 5
|
|
23
|
+
|
|
20
24
|
# Verbose mode
|
|
21
25
|
opencli weibo hot -v
|
|
22
26
|
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# WeChat (微信公众号)
|
|
2
|
+
|
|
3
|
+
**Mode**: 🔐 Browser · **Domain**: `mp.weixin.qq.com`
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
| Command | Description |
|
|
8
|
+
|---------|-------------|
|
|
9
|
+
| `opencli weixin download` | 下载微信公众号文章为 Markdown 格式 |
|
|
10
|
+
|
|
11
|
+
## Usage Examples
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Export article to Markdown
|
|
15
|
+
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --output ./weixin
|
|
16
|
+
|
|
17
|
+
# Export with locally downloaded images
|
|
18
|
+
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --download-images
|
|
19
|
+
|
|
20
|
+
# Export without images
|
|
21
|
+
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --no-download-images
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Output
|
|
25
|
+
|
|
26
|
+
Downloads to `<output>/<article-title>/`:
|
|
27
|
+
- `<article-title>.md` — Markdown with frontmatter (title, author, publish time, source URL)
|
|
28
|
+
- `images/` — Downloaded images (if `--download-images` is enabled, default: true)
|
|
29
|
+
|
|
30
|
+
## Prerequisites
|
|
31
|
+
|
|
32
|
+
- Chrome running and **logged into** mp.weixin.qq.com (for articles behind login wall)
|
|
33
|
+
- [Browser Bridge extension](/guide/browser-bridge) installed
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
|---------|-------------|
|
|
9
9
|
| `opencli wikipedia search` | Search Wikipedia articles |
|
|
10
10
|
| `opencli wikipedia summary` | Get Wikipedia article summary |
|
|
11
|
-
| `opencli wikipedia random` | Get a random Wikipedia article |
|
|
12
|
-
| `opencli wikipedia trending` | Most-read articles (yesterday) |
|
|
13
11
|
|
|
14
12
|
## Usage Examples
|
|
15
13
|
|
|
@@ -20,15 +18,8 @@ opencli wikipedia search "quantum computing" --limit 10
|
|
|
20
18
|
# Get article summary
|
|
21
19
|
opencli wikipedia summary "Artificial intelligence"
|
|
22
20
|
|
|
23
|
-
# Get a random article
|
|
24
|
-
opencli wikipedia random
|
|
25
|
-
|
|
26
|
-
# Most-read articles (yesterday)
|
|
27
|
-
opencli wikipedia trending --limit 5
|
|
28
|
-
|
|
29
21
|
# Use with other languages
|
|
30
22
|
opencli wikipedia search "人工智能" --lang zh
|
|
31
|
-
opencli wikipedia random --lang ja
|
|
32
23
|
|
|
33
24
|
# JSON output
|
|
34
25
|
opencli wikipedia search "Rust" -f json
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
| Command | Description |
|
|
8
8
|
|---------|-------------|
|
|
9
|
-
| `opencli xiaohongshu search` | |
|
|
9
|
+
| `opencli xiaohongshu search` | Search notes by keyword (returns title, author, likes, URL) |
|
|
10
10
|
| `opencli xiaohongshu notifications` | |
|
|
11
11
|
| `opencli xiaohongshu feed` | |
|
|
12
12
|
| `opencli xiaohongshu user` | |
|
|
@@ -20,14 +20,16 @@
|
|
|
20
20
|
## Usage Examples
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
#
|
|
24
|
-
opencli xiaohongshu search --limit
|
|
23
|
+
# Search for notes
|
|
24
|
+
opencli xiaohongshu search 美食 --limit 10
|
|
25
25
|
|
|
26
26
|
# JSON output
|
|
27
|
-
opencli xiaohongshu search -f json
|
|
27
|
+
opencli xiaohongshu search 旅行 -f json
|
|
28
28
|
|
|
29
|
-
#
|
|
30
|
-
opencli xiaohongshu
|
|
29
|
+
# Other commands
|
|
30
|
+
opencli xiaohongshu feed
|
|
31
|
+
opencli xiaohongshu notifications
|
|
32
|
+
opencli xiaohongshu download <url>
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
## Prerequisites
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Yollomi
|
|
2
|
+
|
|
3
|
+
**Mode**: 🔐 Browser · **Domain**: `yollomi.com`
|
|
4
|
+
|
|
5
|
+
AI image/video generation and editing on [yollomi.com](https://yollomi.com). Uses the same `/api/ai/*` routes as the web app; authentication is your **logged-in Chrome session** (NextAuth cookies).
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
| Command | Description |
|
|
10
|
+
|---------|-------------|
|
|
11
|
+
| `opencli yollomi generate` | Text-to-image / image-to-image |
|
|
12
|
+
| `opencli yollomi video` | Text-to-video / image-to-video |
|
|
13
|
+
| `opencli yollomi edit` | Qwen image edit (prompt + image) |
|
|
14
|
+
| `opencli yollomi upload` | Upload a local file → public URL for other commands |
|
|
15
|
+
| `opencli yollomi models` | List image / video / tool models and credit costs |
|
|
16
|
+
| `opencli yollomi remove-bg` | Remove background (free) |
|
|
17
|
+
| `opencli yollomi upscale` | Image upscaling |
|
|
18
|
+
| `opencli yollomi face-swap` | Face swap between two images |
|
|
19
|
+
| `opencli yollomi restore` | Photo restoration |
|
|
20
|
+
| `opencli yollomi try-on` | Virtual try-on |
|
|
21
|
+
| `opencli yollomi background` | AI background for product/object images |
|
|
22
|
+
| `opencli yollomi object-remover` | Remove objects (image + mask URLs) |
|
|
23
|
+
|
|
24
|
+
## Usage Examples
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# List models
|
|
28
|
+
opencli yollomi models --type image
|
|
29
|
+
|
|
30
|
+
# Text-to-image (default model: z-image-turbo)
|
|
31
|
+
opencli yollomi generate "a red apple on a wooden table"
|
|
32
|
+
|
|
33
|
+
# Choose model and aspect ratio
|
|
34
|
+
opencli yollomi generate "sunset" --model flux-schnell --ratio 16:9
|
|
35
|
+
|
|
36
|
+
# Image-to-image: upload first, then pass URL
|
|
37
|
+
opencli yollomi upload ./photo.png
|
|
38
|
+
opencli yollomi generate "oil painting style" --model flux-2-pro --image "https://..."
|
|
39
|
+
|
|
40
|
+
# Video
|
|
41
|
+
opencli yollomi video "waves on a beach" --model kling-2-1
|
|
42
|
+
|
|
43
|
+
# Tools
|
|
44
|
+
opencli yollomi remove-bg https://example.com/image.png
|
|
45
|
+
opencli yollomi upscale https://example.com/image.png --scale 4
|
|
46
|
+
opencli yollomi edit https://example.com/in.png "make it vintage"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Common options
|
|
50
|
+
|
|
51
|
+
| Option | Applies to | Description |
|
|
52
|
+
|--------|------------|-------------|
|
|
53
|
+
| `--model` | `generate`, `video` | Model id (see `yollomi models`) |
|
|
54
|
+
| `--ratio` | `generate`, `video` | Aspect ratio, e.g. `1:1`, `16:9` |
|
|
55
|
+
| `--image` | `generate`, `video` | Image URL for img2img / i2v |
|
|
56
|
+
| `--output` | Most | Output directory (default `./yollomi-output`) |
|
|
57
|
+
| `--no-download` | Several | Print URLs only, skip saving files |
|
|
58
|
+
|
|
59
|
+
## Prerequisites
|
|
60
|
+
|
|
61
|
+
- Chrome running and **logged into** [yollomi.com](https://yollomi.com) (Google OAuth)
|
|
62
|
+
- [Browser Bridge extension](/guide/browser-bridge) installed; daemon connects on first command
|
|
63
|
+
|
|
64
|
+
The CLI ensures the automation tab is on `yollomi.com` before calling APIs (same-origin `fetch` with session cookies).
|
|
65
|
+
|
|
66
|
+
## Notes
|
|
67
|
+
|
|
68
|
+
- **Credits**: Each model consumes account credits; insufficient credits returns HTTP 402.
|
|
69
|
+
- **Upload**: Local paths for tools are not accepted directly — use `yollomi upload` to get a URL, or pass an existing HTTPS image URL.
|
|
@@ -47,6 +47,3 @@ Quickly target and switch the active LLM engine. Example: `opencli antigravity m
|
|
|
47
47
|
|
|
48
48
|
### `opencli antigravity watch`
|
|
49
49
|
A long-running, streaming process that continuously polls the Antigravity UI for chat updates and outputs them in real-time to standard output.
|
|
50
|
-
|
|
51
|
-
### `opencli antigravity serve --port 8082`
|
|
52
|
-
Start an Anthropic-compatible `/v1/messages` proxy backed by the local Antigravity app. Useful when you want external tools to talk to Antigravity through an API-shaped interface.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Doubao App (豆包桌面版)
|
|
2
|
+
|
|
3
|
+
Control the **Doubao AI Desktop App** via Chrome DevTools Protocol (CDP).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. Launch Doubao Desktop with remote debugging enabled:
|
|
8
|
+
```bash
|
|
9
|
+
/Applications/Doubao.app/Contents/MacOS/Doubao --remote-debugging-port=9225
|
|
10
|
+
```
|
|
11
|
+
2. Set the CDP endpoint:
|
|
12
|
+
```bash
|
|
13
|
+
export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9225"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
| Command | Description |
|
|
19
|
+
|---------|-------------|
|
|
20
|
+
| `opencli doubao-app status` | Check CDP connection status |
|
|
21
|
+
| `opencli doubao-app new` | Start a new conversation |
|
|
22
|
+
| `opencli doubao-app send "message"` | Send a message to the current chat |
|
|
23
|
+
| `opencli doubao-app read` | Read the latest assistant reply |
|
|
24
|
+
| `opencli doubao-app ask "message"` | Send a prompt and wait for the reply |
|
|
25
|
+
| `opencli doubao-app screenshot` | Capture a screenshot of the app window |
|
|
26
|
+
| `opencli doubao-app dump` | Export DOM and snapshot debug info |
|
|
27
|
+
|
|
28
|
+
## How It Works
|
|
29
|
+
|
|
30
|
+
Connects to the Doubao Electron app via CDP, injecting JavaScript into the renderer process to control the chat UI — sending messages, reading replies, and capturing screenshots.
|
|
31
|
+
|
|
32
|
+
## Limitations
|
|
33
|
+
|
|
34
|
+
- Requires Doubao Desktop to be launched with `--remote-debugging-port`
|
|
35
|
+
- macOS / Linux / Windows (Electron-based, platform independent)
|
package/docs/adapters/index.md
CHANGED
|
@@ -6,34 +6,43 @@ Run `opencli list` for the live registry.
|
|
|
6
6
|
|
|
7
7
|
| Site | Commands | Mode |
|
|
8
8
|
|------|----------|------|
|
|
9
|
-
| **[twitter](/adapters/browser/twitter)** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` `download` `accept` `reply-dm` | 🔐 Browser |
|
|
9
|
+
| **[twitter](/adapters/browser/twitter)** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` `download` `accept` `reply-dm` `block` `unblock` `hide-reply` | 🔐 Browser |
|
|
10
10
|
| **[reddit](/adapters/browser/reddit)** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 🔐 Browser |
|
|
11
11
|
| **[bilibili](/adapters/browser/bilibili)** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `dynamic` `ranking` `following` `user-videos` `download` | 🔐 Browser |
|
|
12
12
|
| **[zhihu](/adapters/browser/zhihu)** | `hot` `search` `question` `download` | 🔐 Browser |
|
|
13
|
-
| **[xiaohongshu](/adapters/browser/xiaohongshu)** | `search` `notifications` `feed` `
|
|
14
|
-
| **[xueqiu](/adapters/browser/xueqiu)** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 🔐 Browser |
|
|
13
|
+
| **[xiaohongshu](/adapters/browser/xiaohongshu)** | `search` `notifications` `feed` `user` `download` `publish` `creator-notes` `creator-note-detail` `creator-notes-summary` `creator-profile` `creator-stats` | 🔐 Browser |
|
|
14
|
+
| **[xueqiu](/adapters/browser/xueqiu)** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` `earnings-date` | 🔐 Browser |
|
|
15
15
|
| **[youtube](/adapters/browser/youtube)** | `search` `video` `transcript` | 🔐 Browser |
|
|
16
|
-
| **[v2ex](/adapters/browser/v2ex)** | `hot` `latest` `topic` `daily` `me` `notifications` | 🌐 / 🔐 |
|
|
16
|
+
| **[v2ex](/adapters/browser/v2ex)** | `hot` `latest` `topic` `node` `user` `member` `replies` `nodes` `daily` `me` `notifications` | 🌐 / 🔐 |
|
|
17
17
|
| **[bloomberg](/adapters/browser/bloomberg)** | `main` `markets` `economics` `industries` `tech` `politics` `businessweek` `opinions` `feeds` `news` | 🌐 / 🔐 |
|
|
18
|
-
| **[weibo](/adapters/browser/weibo)** | `hot` | 🔐 Browser |
|
|
18
|
+
| **[weibo](/adapters/browser/weibo)** | `hot` `search` | 🔐 Browser |
|
|
19
19
|
| **[linkedin](/adapters/browser/linkedin)** | `search` | 🔐 Browser |
|
|
20
20
|
| **[coupang](/adapters/browser/coupang)** | `search` `add-to-cart` | 🔐 Browser |
|
|
21
|
-
| **[boss](/adapters/browser/boss)** | `search` `detail` | 🔐 Browser |
|
|
21
|
+
| **[boss](/adapters/browser/boss)** | `search` `detail` `recommend` `joblist` `greet` `batchgreet` `send` `chatlist` `chatmsg` `invite` `mark` `exchange` `resume` `stats` | 🔐 Browser |
|
|
22
22
|
| **[ctrip](/adapters/browser/ctrip)** | `search` | 🔐 Browser |
|
|
23
23
|
| **[reuters](/adapters/browser/reuters)** | `search` | 🔐 Browser |
|
|
24
24
|
| **[smzdm](/adapters/browser/smzdm)** | `search` | 🔐 Browser |
|
|
25
25
|
| **[jike](/adapters/browser/jike)** | `feed` `search` `post` `topic` `user` `create` `comment` `like` `repost` `notifications` | 🔐 Browser |
|
|
26
26
|
| **[jimeng](/adapters/browser/jimeng)** | `generate` `history` | 🔐 Browser |
|
|
27
|
+
| **[yollomi](/adapters/browser/yollomi)** | `generate` `video` `edit` `upload` `models` `remove-bg` `upscale` `face-swap` `restore` `try-on` `background` `object-remover` | 🔐 Browser |
|
|
27
28
|
| **[linux-do](/adapters/browser/linux-do)** | `hot` `latest` `categories` `category` `search` `topic` | 🔐 Browser |
|
|
28
29
|
| **[chaoxing](/adapters/browser/chaoxing)** | `assignments` `exams` | 🔐 Browser |
|
|
29
30
|
| **[grok](/adapters/browser/grok)** | `ask` | 🔐 Browser |
|
|
31
|
+
| **[doubao](/adapters/browser/doubao)** | `status` `new` `send` `read` `ask` | 🔐 Browser |
|
|
30
32
|
| **[weread](/adapters/browser/weread)** | `shelf` `search` `book` `ranking` `notebooks` `highlights` `notes` | 🔐 Browser |
|
|
33
|
+
| **[douban](/adapters/browser/douban)** | `search` `top250` `subject` `marks` `reviews` `movie-hot` `book-hot` | 🔐 Browser |
|
|
34
|
+
| **[facebook](/adapters/browser/facebook)** | `feed` `profile` `search` `friends` `groups` `events` `notifications` `memories` `add-friend` `join-group` | 🔐 Browser |
|
|
35
|
+
| **[instagram](/adapters/browser/instagram)** | `explore` `profile` `search` `user` `followers` `following` `follow` `unfollow` `like` `unlike` `comment` `save` `unsave` `saved` | 🔐 Browser |
|
|
36
|
+
| **[medium](/adapters/browser/medium)** | `feed` `search` `user` | 🔐 Browser |
|
|
37
|
+
| **[sinablog](/adapters/browser/sinablog)** | `hot` `search` `article` `user` | 🔐 Browser |
|
|
38
|
+
| **[substack](/adapters/browser/substack)** | `feed` `search` `publication` | 🔐 Browser |
|
|
39
|
+
| **[tiktok](/adapters/browser/tiktok)** | `explore` `search` `profile` `user` `following` `follow` `unfollow` `like` `unlike` `comment` `save` `unsave` `live` `notifications` `friends` | 🔐 Browser |
|
|
31
40
|
|
|
32
41
|
## Public API Adapters
|
|
33
42
|
|
|
34
43
|
| Site | Commands | Mode |
|
|
35
44
|
|------|----------|------|
|
|
36
|
-
| **[hackernews](/adapters/browser/hackernews)** | `top` | 🌐 Public |
|
|
45
|
+
| **[hackernews](/adapters/browser/hackernews)** | `top` `new` `best` `ask` `show` `jobs` `search` `user` | 🌐 Public |
|
|
37
46
|
| **[bbc](/adapters/browser/bbc)** | `news` | 🌐 Public |
|
|
38
47
|
| **[devto](/adapters/browser/devto)** | `top` `tag` `user` | 🌐 Public |
|
|
39
48
|
| **[apple-podcasts](/adapters/browser/apple-podcasts)** | `search` `episodes` `top` | 🌐 Public |
|
|
@@ -44,7 +53,8 @@ Run `opencli list` for the live registry.
|
|
|
44
53
|
| **[hf](/adapters/browser/hf)** | `top` | 🌐 Public |
|
|
45
54
|
| **[sinafinance](/adapters/browser/sinafinance)** | `news` | 🌐 Public |
|
|
46
55
|
| **[stackoverflow](/adapters/browser/stackoverflow)** | `hot` `search` `bounties` `unanswered` | 🌐 Public |
|
|
47
|
-
| **[wikipedia](/adapters/browser/wikipedia)** | `search` `summary` | 🌐 Public |
|
|
56
|
+
| **[wikipedia](/adapters/browser/wikipedia)** | `search` `summary` `random` `trending` | 🌐 Public |
|
|
57
|
+
| **[lobsters](/adapters/browser/lobsters)** | `hot` `newest` `active` `tag` | 🌐 Public |
|
|
48
58
|
|
|
49
59
|
## Desktop Adapters
|
|
50
60
|
|
|
@@ -57,3 +67,4 @@ Run `opencli list` for the live registry.
|
|
|
57
67
|
| **[ChatWise](/adapters/desktop/chatwise)** | Multi-LLM client | `status` `new` `send` `read` `ask` `model` `history` `export` `screenshot` |
|
|
58
68
|
| **[Notion](/adapters/desktop/notion)** | Search, read, write pages | `status` `search` `read` `new` `write` `sidebar` `favorites` `export` |
|
|
59
69
|
| **[Discord](/adapters/desktop/discord)** | Desktop messages & channels | `status` `send` `read` `channels` `servers` `search` `members` |
|
|
70
|
+
| **[Doubao App](/adapters/desktop/doubao-app)** | Doubao AI desktop app via CDP | `status` `new` `send` `read` `ask` `screenshot` `dump` |
|
|
@@ -10,6 +10,7 @@ OpenCLI supports downloading images, videos, and articles from supported platfor
|
|
|
10
10
|
| **bilibili** | Videos | Requires `yt-dlp` installed |
|
|
11
11
|
| **twitter** | Images, Videos | Downloads from user media tab or single tweet |
|
|
12
12
|
| **zhihu** | Articles (Markdown) | Exports articles with optional image download |
|
|
13
|
+
| **weixin** | Articles (Markdown) | Exports WeChat Official Account articles |
|
|
13
14
|
|
|
14
15
|
## Prerequisites
|
|
15
16
|
|
|
@@ -43,6 +44,9 @@ opencli zhihu download "https://zhuanlan.zhihu.com/p/xxx" --output ./zhihu
|
|
|
43
44
|
|
|
44
45
|
# Export with local images
|
|
45
46
|
opencli zhihu download "https://zhuanlan.zhihu.com/p/xxx" --download-images
|
|
47
|
+
|
|
48
|
+
# Export WeChat article to Markdown
|
|
49
|
+
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" --output ./weixin
|
|
46
50
|
```
|
|
47
51
|
|
|
48
52
|
## Pipeline Step (YAML Adapters)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackwener/opencli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,11 +53,13 @@
|
|
|
53
53
|
"cli-table3": "^0.6.5",
|
|
54
54
|
"commander": "^14.0.3",
|
|
55
55
|
"js-yaml": "^4.1.0",
|
|
56
|
+
"turndown": "^7.2.2",
|
|
56
57
|
"ws": "^8.18.0"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@types/js-yaml": "^4.0.9",
|
|
60
61
|
"@types/node": "^22.13.10",
|
|
62
|
+
"@types/turndown": "^5.0.6",
|
|
61
63
|
"@types/ws": "^8.5.13",
|
|
62
64
|
"tsx": "^4.19.3",
|
|
63
65
|
"typescript": "^5.8.2",
|
package/src/browser/cdp.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { WebSocket, type RawData } from 'ws';
|
|
|
12
12
|
import type { BrowserCookie, IPage, ScreenshotOptions, SnapshotOptions, WaitOptions } from '../types.js';
|
|
13
13
|
import { wrapForEval } from './utils.js';
|
|
14
14
|
import { generateSnapshotJs, scrollToRefJs, getFormStateJs } from './dom-snapshot.js';
|
|
15
|
+
import { generateStealthJs } from './stealth.js';
|
|
15
16
|
import {
|
|
16
17
|
clickJs,
|
|
17
18
|
typeTextJs,
|
|
@@ -71,9 +72,16 @@ export class CDPBridge {
|
|
|
71
72
|
const timeoutMs = (opts?.timeout ?? 10) * 1000; // opts.timeout is in seconds
|
|
72
73
|
const timeout = setTimeout(() => reject(new Error('CDP connect timeout')), timeoutMs);
|
|
73
74
|
|
|
74
|
-
ws.on('open', () => {
|
|
75
|
+
ws.on('open', async () => {
|
|
75
76
|
clearTimeout(timeout);
|
|
76
77
|
this._ws = ws;
|
|
78
|
+
// Register stealth script to run before any page JS on every navigation.
|
|
79
|
+
try {
|
|
80
|
+
await this.send('Page.enable');
|
|
81
|
+
await this.send('Page.addScriptToEvaluateOnNewDocument', { source: generateStealthJs() });
|
|
82
|
+
} catch {
|
|
83
|
+
// Non-fatal: stealth is best-effort
|
|
84
|
+
}
|
|
77
85
|
resolve(new CDPPage(this));
|
|
78
86
|
});
|
|
79
87
|
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Provides a typed send() function that posts a Command and returns a Result.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const DAEMON_URL = `http://127.0.0.1:${DAEMON_PORT}`;
|
|
9
|
-
|
|
7
|
+
import { DEFAULT_DAEMON_PORT } from '../constants.js';
|
|
10
8
|
import type { BrowserSessionInfo } from '../types.js';
|
|
11
9
|
|
|
10
|
+
const DAEMON_PORT = parseInt(process.env.OPENCLI_DAEMON_PORT ?? String(DEFAULT_DAEMON_PORT), 10);
|
|
11
|
+
const DAEMON_URL = `http://127.0.0.1:${DAEMON_PORT}`;
|
|
12
|
+
|
|
12
13
|
let _idCounter = 0;
|
|
13
14
|
|
|
14
15
|
function generateId(): string {
|
package/src/browser/discover.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* scanning for @playwright/mcp locations.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { DEFAULT_DAEMON_PORT } from '../constants.js';
|
|
8
9
|
import { isDaemonRunning } from './daemon-client.js';
|
|
9
10
|
|
|
10
11
|
export { isDaemonRunning };
|
|
@@ -17,7 +18,7 @@ export async function checkDaemonStatus(): Promise<{
|
|
|
17
18
|
extensionConnected: boolean;
|
|
18
19
|
}> {
|
|
19
20
|
try {
|
|
20
|
-
const port = parseInt(process.env.OPENCLI_DAEMON_PORT ??
|
|
21
|
+
const port = parseInt(process.env.OPENCLI_DAEMON_PORT ?? String(DEFAULT_DAEMON_PORT), 10);
|
|
21
22
|
const res = await fetch(`http://127.0.0.1:${port}/status`, {
|
|
22
23
|
headers: { 'X-OpenCLI': '1' },
|
|
23
24
|
});
|
package/src/browser/errors.ts
CHANGED
|
@@ -5,31 +5,38 @@
|
|
|
5
5
|
* The daemon architecture has a single failure mode: daemon not reachable or extension not connected.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { BrowserConnectError } from '../errors.js';
|
|
9
|
+
import { DEFAULT_DAEMON_PORT } from '../constants.js';
|
|
10
|
+
|
|
8
11
|
export type ConnectFailureKind = 'daemon-not-running' | 'extension-not-connected' | 'command-failed' | 'unknown';
|
|
9
12
|
|
|
10
|
-
export function formatBrowserConnectError(kind: ConnectFailureKind, detail?: string):
|
|
13
|
+
export function formatBrowserConnectError(kind: ConnectFailureKind, detail?: string): BrowserConnectError {
|
|
11
14
|
switch (kind) {
|
|
12
15
|
case 'daemon-not-running':
|
|
13
|
-
return new
|
|
14
|
-
'Cannot connect to opencli daemon
|
|
16
|
+
return new BrowserConnectError(
|
|
17
|
+
'Cannot connect to opencli daemon.' +
|
|
18
|
+
(detail ? `\n\n${detail}` : ''),
|
|
15
19
|
'The daemon should start automatically. If it doesn\'t, try:\n' +
|
|
16
20
|
' node dist/daemon.js\n' +
|
|
17
|
-
|
|
18
|
-
(detail ? `\n\n${detail}` : ''),
|
|
21
|
+
`Make sure port ${DEFAULT_DAEMON_PORT} is available.`,
|
|
19
22
|
);
|
|
20
23
|
case 'extension-not-connected':
|
|
21
|
-
return new
|
|
22
|
-
'opencli Browser Bridge extension is not connected
|
|
24
|
+
return new BrowserConnectError(
|
|
25
|
+
'opencli Browser Bridge extension is not connected.' +
|
|
26
|
+
(detail ? `\n\n${detail}` : ''),
|
|
23
27
|
'Please install the extension:\n' +
|
|
24
28
|
' 1. Download from GitHub Releases\n' +
|
|
25
29
|
' 2. Open chrome://extensions/ → Enable Developer Mode\n' +
|
|
26
30
|
' 3. Click "Load unpacked" → select the extension folder\n' +
|
|
27
|
-
' 4. Make sure Chrome is running'
|
|
28
|
-
(detail ? `\n\n${detail}` : ''),
|
|
31
|
+
' 4. Make sure Chrome is running',
|
|
29
32
|
);
|
|
30
33
|
case 'command-failed':
|
|
31
|
-
return new
|
|
34
|
+
return new BrowserConnectError(
|
|
35
|
+
`Browser command failed: ${detail ?? 'unknown error'}`,
|
|
36
|
+
);
|
|
32
37
|
default:
|
|
33
|
-
return new
|
|
38
|
+
return new BrowserConnectError(
|
|
39
|
+
detail ?? 'Failed to connect to browser',
|
|
40
|
+
);
|
|
34
41
|
}
|
|
35
42
|
}
|
package/src/browser/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { BrowserBridge, BrowserBridge as PlaywrightMCP } from './mcp.js';
|
|
|
10
10
|
export { CDPBridge } from './cdp.js';
|
|
11
11
|
export { isDaemonRunning } from './daemon-client.js';
|
|
12
12
|
export { generateSnapshotJs, scrollToRefJs, getFormStateJs } from './dom-snapshot.js';
|
|
13
|
+
export { generateStealthJs } from './stealth.js';
|
|
13
14
|
export type { SnapshotOptions } from './dom-snapshot.js';
|
|
14
15
|
|
|
15
16
|
import { extractTabEntries, diffTabIndexes, appendLimited } from './tabs.js';
|