@jackwener/opencli 0.9.6 → 1.0.0
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/.github/ISSUE_TEMPLATE/bug_report.yml +83 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +42 -0
- package/.github/ISSUE_TEMPLATE/new_site_adapter.yml +57 -0
- package/.github/dependabot.yml +27 -0
- package/.github/pull_request_template.md +24 -0
- package/.github/workflows/ci.yml +14 -8
- package/.github/workflows/e2e-headed.yml +6 -2
- package/.github/workflows/pkg-pr-new.yml +2 -2
- package/.github/workflows/release-please.yml +25 -0
- package/.github/workflows/release.yml +2 -2
- package/.github/workflows/security.yml +36 -0
- package/CDP.md +1 -1
- package/CDP.zh-CN.md +1 -1
- package/CLI-ELECTRON.md +89 -36
- package/CLI-EXPLORER.md +4 -4
- package/CONTRIBUTING.md +167 -0
- package/README.md +113 -89
- package/README.zh-CN.md +114 -91
- package/SKILL.md +10 -8
- package/TESTING.md +7 -7
- package/dist/browser/daemon-client.d.ts +37 -0
- package/dist/browser/daemon-client.js +82 -0
- package/dist/browser/discover.d.ts +11 -34
- package/dist/browser/discover.js +15 -190
- package/dist/browser/errors.d.ts +6 -20
- package/dist/browser/errors.js +24 -63
- package/dist/browser/index.d.ts +2 -11
- package/dist/browser/index.js +5 -11
- package/dist/browser/mcp.d.ts +9 -18
- package/dist/browser/mcp.js +70 -284
- package/dist/browser/page.d.ts +28 -6
- package/dist/browser/page.js +210 -85
- package/dist/browser.test.js +4 -202
- package/dist/build-manifest.d.ts +26 -0
- package/dist/build-manifest.js +132 -60
- package/dist/build-manifest.test.d.ts +1 -0
- package/dist/build-manifest.test.js +26 -0
- package/dist/cli-manifest.json +1582 -29
- package/dist/clis/bilibili/download.d.ts +10 -0
- package/dist/clis/bilibili/download.js +135 -0
- package/dist/clis/chatwise/ask.d.ts +1 -0
- package/dist/clis/chatwise/ask.js +76 -0
- package/dist/clis/chatwise/export.d.ts +1 -0
- package/dist/clis/chatwise/export.js +46 -0
- package/dist/clis/chatwise/history.d.ts +1 -0
- package/dist/clis/chatwise/history.js +43 -0
- package/dist/clis/chatwise/model.d.ts +1 -0
- package/dist/clis/chatwise/model.js +81 -0
- package/dist/clis/chatwise/new.d.ts +1 -0
- package/dist/clis/chatwise/new.js +18 -0
- package/dist/clis/chatwise/read.d.ts +1 -0
- package/dist/clis/chatwise/read.js +39 -0
- package/dist/clis/chatwise/screenshot.d.ts +1 -0
- package/dist/clis/chatwise/screenshot.js +27 -0
- package/dist/clis/chatwise/send.d.ts +1 -0
- package/dist/clis/chatwise/send.js +45 -0
- package/dist/clis/chatwise/status.d.ts +1 -0
- package/dist/clis/chatwise/status.js +22 -0
- package/dist/clis/discord-app/channels.d.ts +1 -0
- package/dist/clis/discord-app/channels.js +45 -0
- package/dist/clis/discord-app/members.d.ts +1 -0
- package/dist/clis/discord-app/members.js +38 -0
- package/dist/clis/discord-app/read.d.ts +1 -0
- package/dist/clis/discord-app/read.js +45 -0
- package/dist/clis/discord-app/search.d.ts +1 -0
- package/dist/clis/discord-app/search.js +56 -0
- package/dist/clis/discord-app/send.d.ts +1 -0
- package/dist/clis/discord-app/send.js +27 -0
- package/dist/clis/discord-app/servers.d.ts +1 -0
- package/dist/clis/discord-app/servers.js +36 -0
- package/dist/clis/discord-app/status.d.ts +1 -0
- package/dist/clis/discord-app/status.js +16 -0
- package/dist/clis/feishu/new.d.ts +1 -0
- package/dist/clis/feishu/new.js +27 -0
- package/dist/clis/feishu/read.d.ts +1 -0
- package/dist/clis/feishu/read.js +40 -0
- package/dist/clis/feishu/search.d.ts +1 -0
- package/dist/clis/feishu/search.js +30 -0
- package/dist/clis/feishu/send.d.ts +1 -0
- package/dist/clis/feishu/send.js +39 -0
- package/dist/clis/feishu/status.d.ts +1 -0
- package/dist/clis/feishu/status.js +28 -0
- package/dist/clis/grok/ask.d.ts +1 -0
- package/dist/clis/grok/ask.js +82 -0
- package/dist/clis/grok/debug.d.ts +1 -0
- package/dist/clis/grok/debug.js +45 -0
- package/dist/clis/jimeng/generate.yaml +84 -0
- package/dist/clis/jimeng/history.yaml +47 -0
- package/dist/clis/linux-do/categories.yaml +41 -0
- package/dist/clis/linux-do/category.yaml +49 -0
- package/dist/clis/linux-do/hot.yaml +50 -0
- package/dist/clis/linux-do/latest.yaml +40 -0
- package/dist/clis/linux-do/search.yaml +45 -0
- package/dist/clis/linux-do/topic.yaml +38 -0
- package/dist/clis/neteasemusic/like.d.ts +1 -0
- package/dist/clis/neteasemusic/like.js +25 -0
- package/dist/clis/neteasemusic/lyrics.d.ts +1 -0
- package/dist/clis/neteasemusic/lyrics.js +47 -0
- package/dist/clis/neteasemusic/next.d.ts +1 -0
- package/dist/clis/neteasemusic/next.js +26 -0
- package/dist/clis/neteasemusic/play.d.ts +1 -0
- package/dist/clis/neteasemusic/play.js +26 -0
- package/dist/clis/neteasemusic/playing.d.ts +1 -0
- package/dist/clis/neteasemusic/playing.js +59 -0
- package/dist/clis/neteasemusic/playlist.d.ts +1 -0
- package/dist/clis/neteasemusic/playlist.js +46 -0
- package/dist/clis/neteasemusic/prev.d.ts +1 -0
- package/dist/clis/neteasemusic/prev.js +25 -0
- package/dist/clis/neteasemusic/search.d.ts +1 -0
- package/dist/clis/neteasemusic/search.js +52 -0
- package/dist/clis/neteasemusic/status.d.ts +1 -0
- package/dist/clis/neteasemusic/status.js +16 -0
- package/dist/clis/neteasemusic/volume.d.ts +1 -0
- package/dist/clis/neteasemusic/volume.js +54 -0
- package/dist/clis/notion/export.d.ts +1 -0
- package/dist/clis/notion/export.js +31 -0
- package/dist/clis/notion/favorites.d.ts +1 -0
- package/dist/clis/notion/favorites.js +84 -0
- package/dist/clis/notion/new.d.ts +1 -0
- package/dist/clis/notion/new.js +34 -0
- package/dist/clis/notion/read.d.ts +1 -0
- package/dist/clis/notion/read.js +30 -0
- package/dist/clis/notion/search.d.ts +1 -0
- package/dist/clis/notion/search.js +46 -0
- package/dist/clis/notion/sidebar.d.ts +1 -0
- package/dist/clis/notion/sidebar.js +41 -0
- package/dist/clis/notion/status.d.ts +1 -0
- package/dist/clis/notion/status.js +16 -0
- package/dist/clis/notion/write.d.ts +1 -0
- package/dist/clis/notion/write.js +40 -0
- package/dist/clis/twitter/download.d.ts +8 -0
- package/dist/clis/twitter/download.js +204 -0
- package/dist/clis/wechat/chats.d.ts +1 -0
- package/dist/clis/wechat/chats.js +28 -0
- package/dist/clis/wechat/contacts.d.ts +1 -0
- package/dist/clis/wechat/contacts.js +28 -0
- package/dist/clis/wechat/read.d.ts +1 -0
- package/dist/clis/wechat/read.js +58 -0
- package/dist/clis/wechat/search.d.ts +1 -0
- package/dist/clis/wechat/search.js +31 -0
- package/dist/clis/wechat/send.d.ts +1 -0
- package/dist/clis/wechat/send.js +42 -0
- package/dist/clis/wechat/status.d.ts +1 -0
- package/dist/clis/wechat/status.js +29 -0
- package/dist/clis/xiaohongshu/creator-note-detail.d.ts +10 -0
- package/dist/clis/xiaohongshu/creator-note-detail.js +88 -0
- package/dist/clis/xiaohongshu/creator-notes.d.ts +11 -0
- package/dist/clis/xiaohongshu/creator-notes.js +109 -0
- package/dist/clis/xiaohongshu/creator-profile.d.ts +10 -0
- package/dist/clis/xiaohongshu/creator-profile.js +54 -0
- package/dist/clis/xiaohongshu/creator-stats.d.ts +10 -0
- package/dist/clis/xiaohongshu/creator-stats.js +74 -0
- package/dist/clis/xiaohongshu/download.d.ts +7 -0
- package/dist/clis/xiaohongshu/download.js +155 -0
- package/dist/clis/xiaohongshu/search.js +1 -1
- package/dist/clis/xiaohongshu/user-helpers.d.ts +15 -0
- package/dist/clis/xiaohongshu/user-helpers.js +67 -0
- package/dist/clis/xiaohongshu/user-helpers.test.d.ts +1 -0
- package/dist/clis/xiaohongshu/user-helpers.test.js +81 -0
- package/dist/clis/xiaohongshu/user.js +46 -29
- package/dist/clis/zhihu/download.d.ts +11 -0
- package/dist/clis/zhihu/download.js +186 -0
- package/dist/clis/zhihu/download.test.d.ts +1 -0
- package/dist/clis/zhihu/download.test.js +10 -0
- package/dist/daemon.d.ts +13 -0
- package/dist/daemon.js +187 -0
- package/dist/doctor.d.ts +27 -61
- package/dist/doctor.js +70 -601
- package/dist/doctor.test.js +30 -170
- package/dist/download/index.d.ts +79 -0
- package/dist/download/index.js +325 -0
- package/dist/download/progress.d.ts +36 -0
- package/dist/download/progress.js +111 -0
- package/dist/engine.test.js +15 -0
- package/dist/main.js +22 -28
- package/dist/pipeline/executor.test.js +1 -0
- package/dist/pipeline/registry.js +2 -0
- package/dist/pipeline/steps/browser.js +2 -2
- package/dist/pipeline/steps/download.d.ts +34 -0
- package/dist/pipeline/steps/download.js +251 -0
- package/dist/pipeline/steps/intercept.js +1 -2
- package/dist/pipeline/template.js +28 -0
- package/dist/setup.d.ts +6 -0
- package/dist/setup.js +46 -160
- package/dist/types.d.ts +6 -0
- package/extension/icons/icon-128.png +0 -0
- package/extension/icons/icon-16.png +0 -0
- package/extension/icons/icon-32.png +0 -0
- package/extension/icons/icon-48.png +0 -0
- package/extension/manifest.json +31 -0
- package/extension/package.json +16 -0
- package/extension/src/background.ts +293 -0
- package/extension/src/cdp.ts +125 -0
- package/extension/src/protocol.ts +57 -0
- package/extension/store-assets/screenshot-1280x800.png +0 -0
- package/extension/tsconfig.json +15 -0
- package/extension/vite.config.ts +18 -0
- package/package.json +8 -7
- package/scripts/test-site.mjs +70 -0
- package/src/browser/daemon-client.ts +113 -0
- package/src/browser/discover.ts +18 -216
- package/src/browser/errors.ts +30 -100
- package/src/browser/index.ts +6 -12
- package/src/browser/mcp.ts +78 -278
- package/src/browser/page.ts +222 -88
- package/src/browser.test.ts +3 -210
- package/src/build-manifest.test.ts +28 -0
- package/src/build-manifest.ts +147 -57
- package/src/clis/bilibili/download.ts +161 -0
- package/src/clis/chatgpt/README.md +1 -1
- package/src/clis/chatgpt/README.zh-CN.md +1 -1
- package/src/clis/chatwise/README.md +38 -0
- package/src/clis/chatwise/README.zh-CN.md +38 -0
- package/src/clis/chatwise/ask.ts +87 -0
- package/src/clis/chatwise/export.ts +51 -0
- package/src/clis/chatwise/history.ts +47 -0
- package/src/clis/chatwise/model.ts +87 -0
- package/src/clis/chatwise/new.ts +21 -0
- package/src/clis/chatwise/read.ts +42 -0
- package/src/clis/chatwise/screenshot.ts +33 -0
- package/src/clis/chatwise/send.ts +50 -0
- package/src/clis/chatwise/status.ts +25 -0
- package/src/clis/discord-app/README.md +28 -0
- package/src/clis/discord-app/README.zh-CN.md +28 -0
- package/src/clis/discord-app/channels.ts +48 -0
- package/src/clis/discord-app/members.ts +41 -0
- package/src/clis/discord-app/read.ts +49 -0
- package/src/clis/discord-app/search.ts +64 -0
- package/src/clis/discord-app/send.ts +32 -0
- package/src/clis/discord-app/servers.ts +39 -0
- package/src/clis/discord-app/status.ts +18 -0
- package/src/clis/feishu/README.md +20 -0
- package/src/clis/feishu/README.zh-CN.md +20 -0
- package/src/clis/feishu/new.ts +32 -0
- package/src/clis/feishu/read.ts +48 -0
- package/src/clis/feishu/search.ts +35 -0
- package/src/clis/feishu/send.ts +46 -0
- package/src/clis/feishu/status.ts +34 -0
- package/src/clis/grok/ask.ts +90 -0
- package/src/clis/grok/debug.ts +49 -0
- package/src/clis/jimeng/generate.yaml +84 -0
- package/src/clis/jimeng/history.yaml +47 -0
- package/src/clis/linux-do/categories.yaml +41 -0
- package/src/clis/linux-do/category.yaml +49 -0
- package/src/clis/linux-do/hot.yaml +50 -0
- package/src/clis/linux-do/latest.yaml +40 -0
- package/src/clis/linux-do/search.yaml +45 -0
- package/src/clis/linux-do/topic.yaml +38 -0
- package/src/clis/neteasemusic/README.md +31 -0
- package/src/clis/neteasemusic/README.zh-CN.md +31 -0
- package/src/clis/neteasemusic/like.ts +28 -0
- package/src/clis/neteasemusic/lyrics.ts +53 -0
- package/src/clis/neteasemusic/next.ts +30 -0
- package/src/clis/neteasemusic/play.ts +30 -0
- package/src/clis/neteasemusic/playing.ts +62 -0
- package/src/clis/neteasemusic/playlist.ts +51 -0
- package/src/clis/neteasemusic/prev.ts +29 -0
- package/src/clis/neteasemusic/search.ts +58 -0
- package/src/clis/neteasemusic/status.ts +18 -0
- package/src/clis/neteasemusic/volume.ts +61 -0
- package/src/clis/notion/README.md +29 -0
- package/src/clis/notion/README.zh-CN.md +29 -0
- package/src/clis/notion/export.ts +36 -0
- package/src/clis/notion/favorites.ts +87 -0
- package/src/clis/notion/new.ts +39 -0
- package/src/clis/notion/read.ts +33 -0
- package/src/clis/notion/search.ts +54 -0
- package/src/clis/notion/sidebar.ts +44 -0
- package/src/clis/notion/status.ts +18 -0
- package/src/clis/notion/write.ts +45 -0
- package/src/clis/twitter/download.ts +227 -0
- package/src/clis/wechat/README.md +28 -0
- package/src/clis/wechat/README.zh-CN.md +28 -0
- package/src/clis/wechat/chats.ts +33 -0
- package/src/clis/wechat/contacts.ts +33 -0
- package/src/clis/wechat/read.ts +72 -0
- package/src/clis/wechat/search.ts +36 -0
- package/src/clis/wechat/send.ts +49 -0
- package/src/clis/wechat/status.ts +35 -0
- package/src/clis/xiaohongshu/creator-note-detail.ts +95 -0
- package/src/clis/xiaohongshu/creator-notes.ts +116 -0
- package/src/clis/xiaohongshu/creator-profile.ts +60 -0
- package/src/clis/xiaohongshu/creator-stats.ts +81 -0
- package/src/clis/xiaohongshu/download.ts +173 -0
- package/src/clis/xiaohongshu/search.ts +1 -1
- package/src/clis/xiaohongshu/user-helpers.test.ts +106 -0
- package/src/clis/xiaohongshu/user-helpers.ts +85 -0
- package/src/clis/xiaohongshu/user.ts +52 -32
- package/src/clis/zhihu/download.test.ts +12 -0
- package/src/clis/zhihu/download.ts +223 -0
- package/src/daemon.ts +217 -0
- package/src/doctor.test.ts +32 -193
- package/src/doctor.ts +74 -668
- package/src/download/index.ts +395 -0
- package/src/download/progress.ts +125 -0
- package/src/engine.test.ts +17 -0
- package/src/main.ts +18 -26
- package/src/pipeline/executor.test.ts +1 -0
- package/src/pipeline/registry.ts +2 -0
- package/src/pipeline/steps/browser.ts +2 -2
- package/src/pipeline/steps/download.ts +310 -0
- package/src/pipeline/steps/intercept.ts +1 -2
- package/src/pipeline/template.ts +26 -0
- package/src/setup.ts +47 -183
- package/src/types.ts +1 -0
- package/tests/e2e/browser-auth.test.ts +25 -0
package/README.zh-CN.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# OpenCLI
|
|
2
2
|
|
|
3
3
|
> **把任何网站或 Electron 应用变成你的命令行工具。**
|
|
4
|
-
> 零风控 · 复用 Chrome 登录 · AI 自动发现接口 ·
|
|
4
|
+
> 零风控 · 复用 Chrome 登录 · AI 自动发现接口 · 浏览器与桌面端自动化
|
|
5
5
|
|
|
6
6
|
[English](./README.md)
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://nodejs.org)
|
|
10
10
|
[](./LICENSE)
|
|
11
11
|
|
|
12
|
-
OpenCLI 将任何网站或 Electron 应用(如 Antigravity)变成命令行工具 — B站、知乎、小红书、Twitter/X、Reddit、YouTube 等
|
|
12
|
+
OpenCLI 将任何网站或 Electron 应用(如 Antigravity)变成命令行工具 — B站、知乎、小红书、Twitter/X、Reddit、YouTube 等[多种站点与应用](#内置命令) — 复用浏览器登录态,AI 驱动探索。
|
|
13
13
|
|
|
14
14
|
🔥 **opencli 支持 CLI 化所有 electron 应用!最强大更新来袭!** 🔥
|
|
15
15
|
CLI all electron!现在支持把所有 electron 应用 CLI 化,从而组合出各种神奇的能力。
|
|
@@ -24,6 +24,7 @@ CLI all electron!现在支持把所有 electron 应用 CLI 化,从而组合
|
|
|
24
24
|
- [前置要求](#前置要求)
|
|
25
25
|
- [快速开始](#快速开始)
|
|
26
26
|
- [内置命令](#内置命令)
|
|
27
|
+
- [下载支持](#下载支持)
|
|
27
28
|
- [输出格式](#输出格式)
|
|
28
29
|
- [致 AI Agent(开发者指南)](#致-ai-agent开发者指南)
|
|
29
30
|
- [远程 Chrome(服务器/无头环境)](#远程-chrome服务器无头环境)
|
|
@@ -36,7 +37,7 @@ CLI all electron!现在支持把所有 electron 应用 CLI 化,从而组合
|
|
|
36
37
|
## 亮点
|
|
37
38
|
|
|
38
39
|
- **CLI All Electron** — 支持把所有 electron 应用(如 Antigravity Ultra)CLI 化,让 AI 控制自己!
|
|
39
|
-
- **多站点覆盖** — B站、知乎、小红书、Twitter、Reddit
|
|
40
|
+
- **多站点覆盖** — 覆盖 B站、知乎、小红书、Twitter、Reddit,以及多种桌面应用
|
|
40
41
|
- **零风控** — 复用 Chrome 登录态,无需存储任何凭证
|
|
41
42
|
- **自修复配置** — `opencli setup` 自动发现 Token;`opencli doctor` 诊断 10+ 工具配置;`--fix` 一键修复
|
|
42
43
|
- **AI 原生** — `explore` 自动发现 API,`synthesize` 生成适配器,`cascade` 探测认证策略
|
|
@@ -44,74 +45,32 @@ CLI all electron!现在支持把所有 electron 应用 CLI 化,从而组合
|
|
|
44
45
|
|
|
45
46
|
## 前置要求
|
|
46
47
|
|
|
47
|
-
- **Node.js**: >=
|
|
48
|
+
- **Node.js**: >= 20.0.0
|
|
48
49
|
- **Chrome** 浏览器正在运行,且**已登录目标网站**(如 bilibili.com、zhihu.com、xiaohongshu.com)
|
|
49
50
|
|
|
50
51
|
> **⚠️ 重要**:大多数命令复用你的 Chrome 登录状态。运行命令前,你必须已在 Chrome 中打开目标网站并完成登录。如果获取到空数据或报错,请先检查你的浏览器登录状态。
|
|
51
52
|
|
|
52
|
-
OpenCLI
|
|
53
|
-
它会优先复用本地或全局已安装的 `@playwright/mcp`,如果没有嗅探到可用 MCP server,则会自动回退到 `npx -y @playwright/mcp@latest` 启动。
|
|
53
|
+
OpenCLI 通过轻量化的 **Browser Bridge** Chrome 扩展 + 微型 daemon 与浏览器通信(零配置,自动启动)。
|
|
54
54
|
|
|
55
|
-
###
|
|
55
|
+
### Browser Bridge 扩展配置
|
|
56
56
|
|
|
57
|
-
1.
|
|
58
|
-
|
|
57
|
+
1. 在 Chrome 中安装 **opencli Browser Bridge** 扩展:
|
|
58
|
+
- 打开 `chrome://extensions`,启用右上角的 **开发者模式**
|
|
59
|
+
- 点击 **加载已解压的扩展程序**,选择本仓库的 `extension/` 文件夹
|
|
60
|
+
2. 完成!运行任何浏览器命令时 daemon 会自动启动。无需 token,无需手动配置。
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
opencli setup
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
交互式 TUI 会:
|
|
65
|
-
- 🔍 从 Chrome 自动发现 `PLAYWRIGHT_MCP_EXTENSION_TOKEN`(无需手动复制)
|
|
66
|
-
- ☑️ 显示所有支持的工具(Codex、Cursor、Claude Code、Gemini CLI 等)
|
|
67
|
-
- ✏️ 只更新你选中的文件(空格切换,回车确认)
|
|
68
|
-
- 🔌 完成后自动验证浏览器连通性
|
|
69
|
-
|
|
70
|
-
> **Tip**:后续诊断和维护用 `opencli doctor`:
|
|
62
|
+
> **Tip**:后续诊断用 `opencli doctor`:
|
|
71
63
|
> ```bash
|
|
72
|
-
> opencli doctor #
|
|
73
|
-
> opencli doctor --live #
|
|
74
|
-
> opencli doctor --fix # 修复不一致的配置(交互确认)
|
|
75
|
-
> opencli doctor --fix -y # 无交互直接修复所有配置
|
|
64
|
+
> opencli doctor # 检查扩展和 daemon 连通性
|
|
65
|
+
> opencli doctor --live # 额外测试浏览器命令
|
|
76
66
|
> ```
|
|
77
67
|
|
|
78
|
-
**备选方案:CDP 模式 (适用于服务器/无头环境)**
|
|
79
|
-
如果你无法安装浏览器扩展(比如在远程无头服务器上运行 OpenCLI),你可以通过 SSH 隧道或反向代理,利用 CDP (Chrome DevTools Protocol) 连接到本地的 Chrome 浏览器。详细指南请参考 [CDP 连接教程](./CDP.zh-CN.md)。
|
|
80
|
-
|
|
81
|
-
<details>
|
|
82
|
-
<summary>手动配置(备选方案)</summary>
|
|
83
|
-
|
|
84
|
-
配置你的 MCP 客户端(如 Claude/Cursor 等):
|
|
85
|
-
|
|
86
|
-
```json
|
|
87
|
-
{
|
|
88
|
-
"mcpServers": {
|
|
89
|
-
"playwright": {
|
|
90
|
-
"command": "npx",
|
|
91
|
-
"args": ["-y", "@playwright/mcp@latest", "--extension"],
|
|
92
|
-
"env": {
|
|
93
|
-
"PLAYWRIGHT_MCP_EXTENSION_TOKEN": "<你的-token>"
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
在终端环境变量中导出(建议写进 `~/.zshrc`):
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
export PLAYWRIGHT_MCP_EXTENSION_TOKEN="<你的-token>"
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
</details>
|
|
107
|
-
|
|
108
68
|
## 快速开始
|
|
109
69
|
|
|
110
70
|
### npm 全局安装(推荐)
|
|
111
71
|
|
|
112
72
|
```bash
|
|
113
73
|
npm install -g @jackwener/opencli
|
|
114
|
-
opencli setup # 首次使用:配置 Playwright MCP token
|
|
115
74
|
```
|
|
116
75
|
|
|
117
76
|
直接使用:
|
|
@@ -144,34 +103,99 @@ npm install -g @jackwener/opencli@latest
|
|
|
144
103
|
|
|
145
104
|
## 内置命令
|
|
146
105
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
| 站点 | 命令 |
|
|
150
|
-
|
|
151
|
-
| **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark`
|
|
152
|
-
| **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` |
|
|
153
|
-
| **
|
|
154
|
-
| **
|
|
155
|
-
| **codex** | `status` `send` `read` `new` `extract-diff` `model` `ask` `screenshot` `history` `export` |
|
|
156
|
-
| **
|
|
157
|
-
| **
|
|
158
|
-
| **
|
|
159
|
-
| **
|
|
160
|
-
| **
|
|
161
|
-
| **
|
|
162
|
-
| **
|
|
163
|
-
| **
|
|
164
|
-
| **
|
|
165
|
-
| **
|
|
166
|
-
| **
|
|
167
|
-
| **
|
|
168
|
-
| **
|
|
169
|
-
| **
|
|
170
|
-
| **
|
|
171
|
-
| **
|
|
172
|
-
| **
|
|
173
|
-
| **
|
|
174
|
-
| **
|
|
106
|
+
运行 `opencli list` 查看完整注册表。
|
|
107
|
+
|
|
108
|
+
| 站点 | 命令 | 模式 |
|
|
109
|
+
|------|------|------|
|
|
110
|
+
| **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` `download` | 🔐 浏览器 |
|
|
111
|
+
| **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 🔐 浏览器 |
|
|
112
|
+
| **cursor** | `status` `send` `read` `new` `dump` `composer` `model` `extract-code` `ask` `screenshot` `history` `export` | 🖥️ 桌面端 |
|
|
113
|
+
| **bilibili** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `dynamic` `ranking` `following` `user-videos` `download` | 🔐 浏览器 |
|
|
114
|
+
| **codex** | `status` `send` `read` `new` `extract-diff` `model` `ask` `screenshot` `history` `export` | 🖥️ 桌面端 |
|
|
115
|
+
| **chatwise** | `status` `new` `send` `read` `ask` `model` `history` `export` `screenshot` | 🖥️ 桌面端 |
|
|
116
|
+
| **notion** | `status` `search` `read` `new` `write` `sidebar` `favorites` `export` | 🖥️ 桌面端 |
|
|
117
|
+
| **discord-app** | `status` `send` `read` `channels` `servers` `search` `members` | 🖥️ 桌面端 |
|
|
118
|
+
| **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | 🌐 / 🔐 |
|
|
119
|
+
| **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 🔐 浏览器 |
|
|
120
|
+
| **antigravity** | `status` `send` `read` `new` `evaluate` | 🖥️ 桌面端 |
|
|
121
|
+
| **chatgpt** | `status` `new` `send` `read` `ask` | 🖥️ 桌面端 |
|
|
122
|
+
| **xiaohongshu** | `search` `notifications` `feed` `me` `user` `download` | 🔐 浏览器 |
|
|
123
|
+
| **xiaoyuzhou** | `podcast` `podcast-episodes` `episode` | 🌐 公开 |
|
|
124
|
+
| **zhihu** | `hot` `search` `question` `download` | 🔐 浏览器 |
|
|
125
|
+
| **youtube** | `search` `video` `transcript` | 🔐 浏览器 |
|
|
126
|
+
| **boss** | `search` `detail` | 🔐 浏览器 |
|
|
127
|
+
| **coupang** | `search` `add-to-cart` | 🔐 浏览器 |
|
|
128
|
+
| **bbc** | `news` | 🌐 公共 API |
|
|
129
|
+
| **ctrip** | `search` | 🔐 浏览器 |
|
|
130
|
+
| **github** | `search` | 🌐 公共 API |
|
|
131
|
+
| **hackernews** | `top` | 🌐 公共 API |
|
|
132
|
+
| **linkedin** | `search` | 🔐 浏览器 |
|
|
133
|
+
| **reuters** | `search` | 🔐 浏览器 |
|
|
134
|
+
| **smzdm** | `search` | 🔐 浏览器 |
|
|
135
|
+
| **weibo** | `hot` | 🔐 浏览器 |
|
|
136
|
+
| **yahoo-finance** | `quote` | 🔐 浏览器 |
|
|
137
|
+
|
|
138
|
+
## 下载支持
|
|
139
|
+
|
|
140
|
+
OpenCLI 支持从各平台下载图片、视频和文章。
|
|
141
|
+
|
|
142
|
+
### 支持的平台
|
|
143
|
+
|
|
144
|
+
| 平台 | 内容类型 | 说明 |
|
|
145
|
+
|------|----------|------|
|
|
146
|
+
| **小红书** | 图片、视频 | 下载笔记中的所有媒体文件 |
|
|
147
|
+
| **B站** | 视频 | 需要安装 `yt-dlp` |
|
|
148
|
+
| **Twitter/X** | 图片、视频 | 从用户媒体页或单条推文下载 |
|
|
149
|
+
| **知乎** | 文章(Markdown) | 导出文章,可选下载图片到本地 |
|
|
150
|
+
|
|
151
|
+
### 前置依赖
|
|
152
|
+
|
|
153
|
+
下载流媒体平台的视频需要安装 `yt-dlp`:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# 安装 yt-dlp
|
|
157
|
+
pip install yt-dlp
|
|
158
|
+
# 或者
|
|
159
|
+
brew install yt-dlp
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 使用示例
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# 下载小红书笔记中的图片/视频
|
|
166
|
+
opencli xiaohongshu download --note-id abc123 --output ./xhs
|
|
167
|
+
|
|
168
|
+
# 下载B站视频(需要 yt-dlp)
|
|
169
|
+
opencli bilibili download --bvid BV1xxx --output ./bilibili
|
|
170
|
+
opencli bilibili download --bvid BV1xxx --quality 1080p # 指定画质
|
|
171
|
+
|
|
172
|
+
# 下载 Twitter 用户的媒体
|
|
173
|
+
opencli twitter download --username elonmusk --limit 20 --output ./twitter
|
|
174
|
+
|
|
175
|
+
# 下载单条推文的媒体
|
|
176
|
+
opencli twitter download --tweet-url "https://x.com/user/status/123" --output ./twitter
|
|
177
|
+
|
|
178
|
+
# 导出知乎文章为 Markdown
|
|
179
|
+
opencli zhihu download --url "https://zhuanlan.zhihu.com/p/xxx" --output ./zhihu
|
|
180
|
+
|
|
181
|
+
# 导出文章并下载图片到本地
|
|
182
|
+
opencli zhihu download --url "https://zhuanlan.zhihu.com/p/xxx" --download-images
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Pipeline Step(用于 YAML 适配器)
|
|
186
|
+
|
|
187
|
+
`download` step 可以在 YAML 管线中使用:
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
pipeline:
|
|
191
|
+
- fetch: https://api.example.com/media
|
|
192
|
+
- download:
|
|
193
|
+
url: ${{ item.imageUrl }}
|
|
194
|
+
dir: ./downloads
|
|
195
|
+
filename: ${{ item.title | sanitize }}.jpg
|
|
196
|
+
concurrency: 5
|
|
197
|
+
skip_existing: true
|
|
198
|
+
```
|
|
175
199
|
|
|
176
200
|
## 输出格式
|
|
177
201
|
|
|
@@ -214,16 +238,15 @@ opencli cascade https://api.example.com/data
|
|
|
214
238
|
|
|
215
239
|
## 常见问题排查
|
|
216
240
|
|
|
217
|
-
- **"
|
|
218
|
-
- 确保你当前的 Chrome 已安装且**开启了**
|
|
219
|
-
- 如果是刚装完插件,需要重启 Chrome 浏览器。
|
|
241
|
+
- **"Extension not connected" 报错**
|
|
242
|
+
- 确保你当前的 Chrome 已安装且**开启了** opencli Browser Bridge 扩展(在 `chrome://extensions` 中检查)。
|
|
220
243
|
- **返回空数据,或者报错 "Unauthorized"**
|
|
221
|
-
- Chrome
|
|
244
|
+
- Chrome 里的登录态可能已经过期。请打开当前 Chrome 页面,在新标签页重新手工登录或刷新该页面。
|
|
222
245
|
- **Node API 错误 (如 parseArgs, fs 等)**
|
|
223
|
-
- 确保 Node.js 版本 `>=
|
|
224
|
-
- **
|
|
225
|
-
-
|
|
226
|
-
-
|
|
246
|
+
- 确保 Node.js 版本 `>= 20`。
|
|
247
|
+
- **Daemon 问题**
|
|
248
|
+
- 检查 daemon 状态:`curl localhost:19825/status`
|
|
249
|
+
- 查看扩展日志:`curl localhost:19825/logs`
|
|
227
250
|
|
|
228
251
|
## 版本发布
|
|
229
252
|
|
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: opencli
|
|
|
3
3
|
description: "OpenCLI — Make any website or Electron App your CLI. Zero risk, AI-powered, reuse Chrome login. 80+ commands across 19 sites."
|
|
4
4
|
version: 0.7.3
|
|
5
5
|
author: jackwener
|
|
6
|
-
tags: [cli, browser, web,
|
|
6
|
+
tags: [cli, browser, web, chrome-extension, cdp, bilibili, zhihu, twitter, github, v2ex, hackernews, reddit, xiaohongshu, xueqiu, youtube, boss, coupang, AI, agent]
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# OpenCLI
|
|
@@ -12,7 +12,7 @@ tags: [cli, browser, web, mcp, playwright, bilibili, zhihu, twitter, github, v2e
|
|
|
12
12
|
|
|
13
13
|
> [!CAUTION]
|
|
14
14
|
> **AI Agent 必读:创建或修改任何适配器之前,你必须先阅读 [CLI-EXPLORER.md](./CLI-EXPLORER.md)!**
|
|
15
|
-
> 该文档包含完整的 API
|
|
15
|
+
> 该文档包含完整的 API 发现工作流(必须使用浏览器探索)、5 级认证策略决策树、平台 SDK 速查表、`tap` 步骤调试流程、分页 API 模板、级联请求模式、以及常见陷阱。
|
|
16
16
|
> **本文件(SKILL.md)仅提供命令参考和简化模板,不足以正确开发适配器。**
|
|
17
17
|
|
|
18
18
|
## Install & Run
|
|
@@ -34,8 +34,8 @@ npm update -g @jackwener/opencli
|
|
|
34
34
|
|
|
35
35
|
Browser commands require:
|
|
36
36
|
1. Chrome browser running **(logged into target sites)**
|
|
37
|
-
2.
|
|
38
|
-
3.
|
|
37
|
+
2. **opencli Browser Bridge** Chrome extension installed (load `extension/` as unpacked in `chrome://extensions`)
|
|
38
|
+
3. No further setup needed — the daemon auto-starts on first browser command
|
|
39
39
|
|
|
40
40
|
> **Note**: You must be logged into the target website in Chrome before running commands. Tabs opened during command execution are auto-closed afterwards.
|
|
41
41
|
|
|
@@ -227,7 +227,7 @@ opencli bilibili hot -v # Show each pipeline step and data flow
|
|
|
227
227
|
|
|
228
228
|
> [!IMPORTANT]
|
|
229
229
|
> **完整模式 — 在写任何代码之前,先阅读 [CLI-EXPLORER.md](./CLI-EXPLORER.md)。**
|
|
230
|
-
> 它包含:① AI Agent
|
|
230
|
+
> 它包含:① AI Agent 浏览器探索工作流 ② 认证策略决策树 ③ 平台 SDK(如 Bilibili 的 `apiGet`/`fetchJson`)④ YAML vs TS 选择指南 ⑤ `tap` 步骤调试方法 ⑥ 级联请求模板 ⑦ 常见陷阱表。
|
|
231
231
|
> **下方仅为简化模板参考,直接使用极易踩坑。**
|
|
232
232
|
|
|
233
233
|
### YAML Pipeline (declarative, recommended)
|
|
@@ -374,16 +374,18 @@ ${{ index + 1 }}
|
|
|
374
374
|
|
|
375
375
|
| Variable | Default | Description |
|
|
376
376
|
|----------|---------|-------------|
|
|
377
|
+
| `OPENCLI_DAEMON_PORT` | 19825 | Daemon listen port |
|
|
377
378
|
| `OPENCLI_BROWSER_CONNECT_TIMEOUT` | 30 | Browser connection timeout (sec) |
|
|
378
379
|
| `OPENCLI_BROWSER_COMMAND_TIMEOUT` | 45 | Command execution timeout (sec) |
|
|
379
380
|
| `OPENCLI_BROWSER_EXPLORE_TIMEOUT` | 120 | Explore timeout (sec) |
|
|
380
|
-
| `
|
|
381
|
+
| `OPENCLI_VERBOSE` | — | Show daemon/extension logs |
|
|
381
382
|
|
|
382
383
|
## Troubleshooting
|
|
383
384
|
|
|
384
385
|
| Issue | Solution |
|
|
385
386
|
|-------|----------|
|
|
386
387
|
| `npx not found` | Install Node.js: `brew install node` |
|
|
387
|
-
| `
|
|
388
|
+
| `Extension not connected` | 1) Chrome must be open 2) Install opencli Browser Bridge extension |
|
|
388
389
|
| `Target page context` error | Add `navigate:` step before `evaluate:` in YAML |
|
|
389
|
-
| Empty table data | Check if evaluate returns
|
|
390
|
+
| Empty table data | Check if evaluate returns correct data path |
|
|
391
|
+
| Daemon issues | `curl localhost:19825/status` to check, `curl localhost:19825/logs` for extension logs |
|
package/TESTING.md
CHANGED
|
@@ -105,10 +105,10 @@ npx vitest src/
|
|
|
105
105
|
|
|
106
106
|
### 浏览器命令本地测试须知
|
|
107
107
|
|
|
108
|
-
-
|
|
108
|
+
- opencli 通过 Browser Bridge 扩展连接已运行的 Chrome 浏览器
|
|
109
109
|
- `browser-public.test.ts` 使用 `tryBrowserCommand()`,站点反爬导致空数据时 warn + pass
|
|
110
110
|
- `browser-auth.test.ts` 验证 **graceful failure**(不 crash 不 hang 即通过)
|
|
111
|
-
- 如需测试完整登录态,保持 Chrome
|
|
111
|
+
- 如需测试完整登录态,保持 Chrome 登录态并安装 Browser Bridge 扩展,手动跑对应测试
|
|
112
112
|
|
|
113
113
|
---
|
|
114
114
|
|
|
@@ -202,12 +202,12 @@ steps:
|
|
|
202
202
|
|
|
203
203
|
## 浏览器模式
|
|
204
204
|
|
|
205
|
-
opencli
|
|
205
|
+
opencli 通过 Browser Bridge 扩展连接浏览器:
|
|
206
206
|
|
|
207
|
-
| 条件 | 模式 |
|
|
208
|
-
|
|
209
|
-
|
|
|
210
|
-
|
|
|
207
|
+
| 条件 | 模式 | 使用场景 |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| 扩展已安装 | Extension 模式 | 本地用户,连接已登录的 Chrome |
|
|
210
|
+
| 扩展未安装 | CLI 报错提示安装 | 需要安装 Browser Bridge 扩展 |
|
|
211
211
|
|
|
212
212
|
CI 中使用 `OPENCLI_BROWSER_EXECUTABLE_PATH` 指定真实 Chrome 路径:
|
|
213
213
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for communicating with the opencli daemon.
|
|
3
|
+
*
|
|
4
|
+
* Provides a typed send() function that posts a Command and returns a Result.
|
|
5
|
+
*/
|
|
6
|
+
export interface DaemonCommand {
|
|
7
|
+
id: string;
|
|
8
|
+
action: 'exec' | 'navigate' | 'tabs' | 'cookies' | 'screenshot';
|
|
9
|
+
tabId?: number;
|
|
10
|
+
code?: string;
|
|
11
|
+
url?: string;
|
|
12
|
+
op?: string;
|
|
13
|
+
index?: number;
|
|
14
|
+
domain?: string;
|
|
15
|
+
format?: 'png' | 'jpeg';
|
|
16
|
+
quality?: number;
|
|
17
|
+
fullPage?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface DaemonResult {
|
|
20
|
+
id: string;
|
|
21
|
+
ok: boolean;
|
|
22
|
+
data?: unknown;
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if daemon is running.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isDaemonRunning(): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if daemon is running AND the extension is connected.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isExtensionConnected(): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Send a command to the daemon and wait for a result.
|
|
35
|
+
* Retries up to 3 times with 500ms delay for transient failures.
|
|
36
|
+
*/
|
|
37
|
+
export declare function sendCommand(action: DaemonCommand['action'], params?: Omit<DaemonCommand, 'id' | 'action'>): Promise<unknown>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for communicating with the opencli daemon.
|
|
3
|
+
*
|
|
4
|
+
* Provides a typed send() function that posts a Command and returns a Result.
|
|
5
|
+
*/
|
|
6
|
+
const DAEMON_PORT = parseInt(process.env.OPENCLI_DAEMON_PORT ?? '19825', 10);
|
|
7
|
+
const DAEMON_URL = `http://127.0.0.1:${DAEMON_PORT}`;
|
|
8
|
+
let _idCounter = 0;
|
|
9
|
+
function generateId() {
|
|
10
|
+
return `cmd_${Date.now()}_${++_idCounter}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if daemon is running.
|
|
14
|
+
*/
|
|
15
|
+
export async function isDaemonRunning() {
|
|
16
|
+
try {
|
|
17
|
+
const controller = new AbortController();
|
|
18
|
+
const timer = setTimeout(() => controller.abort(), 2000);
|
|
19
|
+
const res = await fetch(`${DAEMON_URL}/status`, { signal: controller.signal });
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
return res.ok;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if daemon is running AND the extension is connected.
|
|
29
|
+
*/
|
|
30
|
+
export async function isExtensionConnected() {
|
|
31
|
+
try {
|
|
32
|
+
const controller = new AbortController();
|
|
33
|
+
const timer = setTimeout(() => controller.abort(), 2000);
|
|
34
|
+
const res = await fetch(`${DAEMON_URL}/status`, { signal: controller.signal });
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
if (!res.ok)
|
|
37
|
+
return false;
|
|
38
|
+
const data = await res.json();
|
|
39
|
+
return !!data.extensionConnected;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Send a command to the daemon and wait for a result.
|
|
47
|
+
* Retries up to 3 times with 500ms delay for transient failures.
|
|
48
|
+
*/
|
|
49
|
+
export async function sendCommand(action, params = {}) {
|
|
50
|
+
const id = generateId();
|
|
51
|
+
const command = { id, action, ...params };
|
|
52
|
+
const maxRetries = 3;
|
|
53
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
54
|
+
try {
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
const timer = setTimeout(() => controller.abort(), 30000);
|
|
57
|
+
const res = await fetch(`${DAEMON_URL}/command`, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: { 'Content-Type': 'application/json' },
|
|
60
|
+
body: JSON.stringify(command),
|
|
61
|
+
signal: controller.signal,
|
|
62
|
+
});
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
const result = (await res.json());
|
|
65
|
+
if (!result.ok) {
|
|
66
|
+
throw new Error(result.error ?? 'Daemon command failed');
|
|
67
|
+
}
|
|
68
|
+
return result.data;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
const isRetryable = err instanceof TypeError // fetch network error
|
|
72
|
+
|| (err instanceof Error && err.name === 'AbortError');
|
|
73
|
+
if (isRetryable && attempt < maxRetries) {
|
|
74
|
+
await new Promise(r => setTimeout(r, 500));
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Unreachable — the loop always returns or throws
|
|
81
|
+
throw new Error('sendCommand: max retries exhausted');
|
|
82
|
+
}
|
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP server path discovery
|
|
2
|
+
* Daemon discovery — simplified from MCP server path discovery.
|
|
3
|
+
*
|
|
4
|
+
* Only needs to check if the daemon is running. No more file system
|
|
5
|
+
* scanning for @playwright/mcp locations.
|
|
3
6
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export declare function resetMcpServerPathCache(): void;
|
|
7
|
-
export declare function setMcpDiscoveryTestHooks(input?: {
|
|
8
|
-
existsSync?: typeof fs.existsSync;
|
|
9
|
-
execSync?: typeof execSync;
|
|
10
|
-
}): void;
|
|
11
|
-
export declare function findMcpServerPath(): string | null;
|
|
7
|
+
import { isDaemonRunning } from './daemon-client.js';
|
|
8
|
+
export { isDaemonRunning };
|
|
12
9
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Starting with Chrome 144, users can enable remote debugging from
|
|
16
|
-
* chrome://inspect#remote-debugging without any command-line flags.
|
|
17
|
-
* Chrome writes the active port and browser GUID to a DevToolsActivePort file
|
|
18
|
-
* in the user data directory, which we read to construct the WebSocket endpoint.
|
|
10
|
+
* Check daemon status and return connection info.
|
|
19
11
|
*/
|
|
20
|
-
export declare function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
export declare function buildMcpArgs(input: {
|
|
26
|
-
mcpPath: string;
|
|
27
|
-
executablePath?: string | null;
|
|
28
|
-
cdpEndpoint?: string;
|
|
29
|
-
}): string[];
|
|
30
|
-
export declare function buildMcpLaunchSpec(input: {
|
|
31
|
-
mcpPath?: string | null;
|
|
32
|
-
executablePath?: string | null;
|
|
33
|
-
cdpEndpoint?: string;
|
|
34
|
-
}): {
|
|
35
|
-
command: string;
|
|
36
|
-
args: string[];
|
|
37
|
-
usedNpxFallback: boolean;
|
|
38
|
-
};
|
|
12
|
+
export declare function checkDaemonStatus(): Promise<{
|
|
13
|
+
running: boolean;
|
|
14
|
+
extensionConnected: boolean;
|
|
15
|
+
}>;
|