@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.
Files changed (307) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +83 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +8 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.yml +42 -0
  4. package/.github/ISSUE_TEMPLATE/new_site_adapter.yml +57 -0
  5. package/.github/dependabot.yml +27 -0
  6. package/.github/pull_request_template.md +24 -0
  7. package/.github/workflows/ci.yml +14 -8
  8. package/.github/workflows/e2e-headed.yml +6 -2
  9. package/.github/workflows/pkg-pr-new.yml +2 -2
  10. package/.github/workflows/release-please.yml +25 -0
  11. package/.github/workflows/release.yml +2 -2
  12. package/.github/workflows/security.yml +36 -0
  13. package/CDP.md +1 -1
  14. package/CDP.zh-CN.md +1 -1
  15. package/CLI-ELECTRON.md +89 -36
  16. package/CLI-EXPLORER.md +4 -4
  17. package/CONTRIBUTING.md +167 -0
  18. package/README.md +113 -89
  19. package/README.zh-CN.md +114 -91
  20. package/SKILL.md +10 -8
  21. package/TESTING.md +7 -7
  22. package/dist/browser/daemon-client.d.ts +37 -0
  23. package/dist/browser/daemon-client.js +82 -0
  24. package/dist/browser/discover.d.ts +11 -34
  25. package/dist/browser/discover.js +15 -190
  26. package/dist/browser/errors.d.ts +6 -20
  27. package/dist/browser/errors.js +24 -63
  28. package/dist/browser/index.d.ts +2 -11
  29. package/dist/browser/index.js +5 -11
  30. package/dist/browser/mcp.d.ts +9 -18
  31. package/dist/browser/mcp.js +70 -284
  32. package/dist/browser/page.d.ts +28 -6
  33. package/dist/browser/page.js +210 -85
  34. package/dist/browser.test.js +4 -202
  35. package/dist/build-manifest.d.ts +26 -0
  36. package/dist/build-manifest.js +132 -60
  37. package/dist/build-manifest.test.d.ts +1 -0
  38. package/dist/build-manifest.test.js +26 -0
  39. package/dist/cli-manifest.json +1582 -29
  40. package/dist/clis/bilibili/download.d.ts +10 -0
  41. package/dist/clis/bilibili/download.js +135 -0
  42. package/dist/clis/chatwise/ask.d.ts +1 -0
  43. package/dist/clis/chatwise/ask.js +76 -0
  44. package/dist/clis/chatwise/export.d.ts +1 -0
  45. package/dist/clis/chatwise/export.js +46 -0
  46. package/dist/clis/chatwise/history.d.ts +1 -0
  47. package/dist/clis/chatwise/history.js +43 -0
  48. package/dist/clis/chatwise/model.d.ts +1 -0
  49. package/dist/clis/chatwise/model.js +81 -0
  50. package/dist/clis/chatwise/new.d.ts +1 -0
  51. package/dist/clis/chatwise/new.js +18 -0
  52. package/dist/clis/chatwise/read.d.ts +1 -0
  53. package/dist/clis/chatwise/read.js +39 -0
  54. package/dist/clis/chatwise/screenshot.d.ts +1 -0
  55. package/dist/clis/chatwise/screenshot.js +27 -0
  56. package/dist/clis/chatwise/send.d.ts +1 -0
  57. package/dist/clis/chatwise/send.js +45 -0
  58. package/dist/clis/chatwise/status.d.ts +1 -0
  59. package/dist/clis/chatwise/status.js +22 -0
  60. package/dist/clis/discord-app/channels.d.ts +1 -0
  61. package/dist/clis/discord-app/channels.js +45 -0
  62. package/dist/clis/discord-app/members.d.ts +1 -0
  63. package/dist/clis/discord-app/members.js +38 -0
  64. package/dist/clis/discord-app/read.d.ts +1 -0
  65. package/dist/clis/discord-app/read.js +45 -0
  66. package/dist/clis/discord-app/search.d.ts +1 -0
  67. package/dist/clis/discord-app/search.js +56 -0
  68. package/dist/clis/discord-app/send.d.ts +1 -0
  69. package/dist/clis/discord-app/send.js +27 -0
  70. package/dist/clis/discord-app/servers.d.ts +1 -0
  71. package/dist/clis/discord-app/servers.js +36 -0
  72. package/dist/clis/discord-app/status.d.ts +1 -0
  73. package/dist/clis/discord-app/status.js +16 -0
  74. package/dist/clis/feishu/new.d.ts +1 -0
  75. package/dist/clis/feishu/new.js +27 -0
  76. package/dist/clis/feishu/read.d.ts +1 -0
  77. package/dist/clis/feishu/read.js +40 -0
  78. package/dist/clis/feishu/search.d.ts +1 -0
  79. package/dist/clis/feishu/search.js +30 -0
  80. package/dist/clis/feishu/send.d.ts +1 -0
  81. package/dist/clis/feishu/send.js +39 -0
  82. package/dist/clis/feishu/status.d.ts +1 -0
  83. package/dist/clis/feishu/status.js +28 -0
  84. package/dist/clis/grok/ask.d.ts +1 -0
  85. package/dist/clis/grok/ask.js +82 -0
  86. package/dist/clis/grok/debug.d.ts +1 -0
  87. package/dist/clis/grok/debug.js +45 -0
  88. package/dist/clis/jimeng/generate.yaml +84 -0
  89. package/dist/clis/jimeng/history.yaml +47 -0
  90. package/dist/clis/linux-do/categories.yaml +41 -0
  91. package/dist/clis/linux-do/category.yaml +49 -0
  92. package/dist/clis/linux-do/hot.yaml +50 -0
  93. package/dist/clis/linux-do/latest.yaml +40 -0
  94. package/dist/clis/linux-do/search.yaml +45 -0
  95. package/dist/clis/linux-do/topic.yaml +38 -0
  96. package/dist/clis/neteasemusic/like.d.ts +1 -0
  97. package/dist/clis/neteasemusic/like.js +25 -0
  98. package/dist/clis/neteasemusic/lyrics.d.ts +1 -0
  99. package/dist/clis/neteasemusic/lyrics.js +47 -0
  100. package/dist/clis/neteasemusic/next.d.ts +1 -0
  101. package/dist/clis/neteasemusic/next.js +26 -0
  102. package/dist/clis/neteasemusic/play.d.ts +1 -0
  103. package/dist/clis/neteasemusic/play.js +26 -0
  104. package/dist/clis/neteasemusic/playing.d.ts +1 -0
  105. package/dist/clis/neteasemusic/playing.js +59 -0
  106. package/dist/clis/neteasemusic/playlist.d.ts +1 -0
  107. package/dist/clis/neteasemusic/playlist.js +46 -0
  108. package/dist/clis/neteasemusic/prev.d.ts +1 -0
  109. package/dist/clis/neteasemusic/prev.js +25 -0
  110. package/dist/clis/neteasemusic/search.d.ts +1 -0
  111. package/dist/clis/neteasemusic/search.js +52 -0
  112. package/dist/clis/neteasemusic/status.d.ts +1 -0
  113. package/dist/clis/neteasemusic/status.js +16 -0
  114. package/dist/clis/neteasemusic/volume.d.ts +1 -0
  115. package/dist/clis/neteasemusic/volume.js +54 -0
  116. package/dist/clis/notion/export.d.ts +1 -0
  117. package/dist/clis/notion/export.js +31 -0
  118. package/dist/clis/notion/favorites.d.ts +1 -0
  119. package/dist/clis/notion/favorites.js +84 -0
  120. package/dist/clis/notion/new.d.ts +1 -0
  121. package/dist/clis/notion/new.js +34 -0
  122. package/dist/clis/notion/read.d.ts +1 -0
  123. package/dist/clis/notion/read.js +30 -0
  124. package/dist/clis/notion/search.d.ts +1 -0
  125. package/dist/clis/notion/search.js +46 -0
  126. package/dist/clis/notion/sidebar.d.ts +1 -0
  127. package/dist/clis/notion/sidebar.js +41 -0
  128. package/dist/clis/notion/status.d.ts +1 -0
  129. package/dist/clis/notion/status.js +16 -0
  130. package/dist/clis/notion/write.d.ts +1 -0
  131. package/dist/clis/notion/write.js +40 -0
  132. package/dist/clis/twitter/download.d.ts +8 -0
  133. package/dist/clis/twitter/download.js +204 -0
  134. package/dist/clis/wechat/chats.d.ts +1 -0
  135. package/dist/clis/wechat/chats.js +28 -0
  136. package/dist/clis/wechat/contacts.d.ts +1 -0
  137. package/dist/clis/wechat/contacts.js +28 -0
  138. package/dist/clis/wechat/read.d.ts +1 -0
  139. package/dist/clis/wechat/read.js +58 -0
  140. package/dist/clis/wechat/search.d.ts +1 -0
  141. package/dist/clis/wechat/search.js +31 -0
  142. package/dist/clis/wechat/send.d.ts +1 -0
  143. package/dist/clis/wechat/send.js +42 -0
  144. package/dist/clis/wechat/status.d.ts +1 -0
  145. package/dist/clis/wechat/status.js +29 -0
  146. package/dist/clis/xiaohongshu/creator-note-detail.d.ts +10 -0
  147. package/dist/clis/xiaohongshu/creator-note-detail.js +88 -0
  148. package/dist/clis/xiaohongshu/creator-notes.d.ts +11 -0
  149. package/dist/clis/xiaohongshu/creator-notes.js +109 -0
  150. package/dist/clis/xiaohongshu/creator-profile.d.ts +10 -0
  151. package/dist/clis/xiaohongshu/creator-profile.js +54 -0
  152. package/dist/clis/xiaohongshu/creator-stats.d.ts +10 -0
  153. package/dist/clis/xiaohongshu/creator-stats.js +74 -0
  154. package/dist/clis/xiaohongshu/download.d.ts +7 -0
  155. package/dist/clis/xiaohongshu/download.js +155 -0
  156. package/dist/clis/xiaohongshu/search.js +1 -1
  157. package/dist/clis/xiaohongshu/user-helpers.d.ts +15 -0
  158. package/dist/clis/xiaohongshu/user-helpers.js +67 -0
  159. package/dist/clis/xiaohongshu/user-helpers.test.d.ts +1 -0
  160. package/dist/clis/xiaohongshu/user-helpers.test.js +81 -0
  161. package/dist/clis/xiaohongshu/user.js +46 -29
  162. package/dist/clis/zhihu/download.d.ts +11 -0
  163. package/dist/clis/zhihu/download.js +186 -0
  164. package/dist/clis/zhihu/download.test.d.ts +1 -0
  165. package/dist/clis/zhihu/download.test.js +10 -0
  166. package/dist/daemon.d.ts +13 -0
  167. package/dist/daemon.js +187 -0
  168. package/dist/doctor.d.ts +27 -61
  169. package/dist/doctor.js +70 -601
  170. package/dist/doctor.test.js +30 -170
  171. package/dist/download/index.d.ts +79 -0
  172. package/dist/download/index.js +325 -0
  173. package/dist/download/progress.d.ts +36 -0
  174. package/dist/download/progress.js +111 -0
  175. package/dist/engine.test.js +15 -0
  176. package/dist/main.js +22 -28
  177. package/dist/pipeline/executor.test.js +1 -0
  178. package/dist/pipeline/registry.js +2 -0
  179. package/dist/pipeline/steps/browser.js +2 -2
  180. package/dist/pipeline/steps/download.d.ts +34 -0
  181. package/dist/pipeline/steps/download.js +251 -0
  182. package/dist/pipeline/steps/intercept.js +1 -2
  183. package/dist/pipeline/template.js +28 -0
  184. package/dist/setup.d.ts +6 -0
  185. package/dist/setup.js +46 -160
  186. package/dist/types.d.ts +6 -0
  187. package/extension/icons/icon-128.png +0 -0
  188. package/extension/icons/icon-16.png +0 -0
  189. package/extension/icons/icon-32.png +0 -0
  190. package/extension/icons/icon-48.png +0 -0
  191. package/extension/manifest.json +31 -0
  192. package/extension/package.json +16 -0
  193. package/extension/src/background.ts +293 -0
  194. package/extension/src/cdp.ts +125 -0
  195. package/extension/src/protocol.ts +57 -0
  196. package/extension/store-assets/screenshot-1280x800.png +0 -0
  197. package/extension/tsconfig.json +15 -0
  198. package/extension/vite.config.ts +18 -0
  199. package/package.json +8 -7
  200. package/scripts/test-site.mjs +70 -0
  201. package/src/browser/daemon-client.ts +113 -0
  202. package/src/browser/discover.ts +18 -216
  203. package/src/browser/errors.ts +30 -100
  204. package/src/browser/index.ts +6 -12
  205. package/src/browser/mcp.ts +78 -278
  206. package/src/browser/page.ts +222 -88
  207. package/src/browser.test.ts +3 -210
  208. package/src/build-manifest.test.ts +28 -0
  209. package/src/build-manifest.ts +147 -57
  210. package/src/clis/bilibili/download.ts +161 -0
  211. package/src/clis/chatgpt/README.md +1 -1
  212. package/src/clis/chatgpt/README.zh-CN.md +1 -1
  213. package/src/clis/chatwise/README.md +38 -0
  214. package/src/clis/chatwise/README.zh-CN.md +38 -0
  215. package/src/clis/chatwise/ask.ts +87 -0
  216. package/src/clis/chatwise/export.ts +51 -0
  217. package/src/clis/chatwise/history.ts +47 -0
  218. package/src/clis/chatwise/model.ts +87 -0
  219. package/src/clis/chatwise/new.ts +21 -0
  220. package/src/clis/chatwise/read.ts +42 -0
  221. package/src/clis/chatwise/screenshot.ts +33 -0
  222. package/src/clis/chatwise/send.ts +50 -0
  223. package/src/clis/chatwise/status.ts +25 -0
  224. package/src/clis/discord-app/README.md +28 -0
  225. package/src/clis/discord-app/README.zh-CN.md +28 -0
  226. package/src/clis/discord-app/channels.ts +48 -0
  227. package/src/clis/discord-app/members.ts +41 -0
  228. package/src/clis/discord-app/read.ts +49 -0
  229. package/src/clis/discord-app/search.ts +64 -0
  230. package/src/clis/discord-app/send.ts +32 -0
  231. package/src/clis/discord-app/servers.ts +39 -0
  232. package/src/clis/discord-app/status.ts +18 -0
  233. package/src/clis/feishu/README.md +20 -0
  234. package/src/clis/feishu/README.zh-CN.md +20 -0
  235. package/src/clis/feishu/new.ts +32 -0
  236. package/src/clis/feishu/read.ts +48 -0
  237. package/src/clis/feishu/search.ts +35 -0
  238. package/src/clis/feishu/send.ts +46 -0
  239. package/src/clis/feishu/status.ts +34 -0
  240. package/src/clis/grok/ask.ts +90 -0
  241. package/src/clis/grok/debug.ts +49 -0
  242. package/src/clis/jimeng/generate.yaml +84 -0
  243. package/src/clis/jimeng/history.yaml +47 -0
  244. package/src/clis/linux-do/categories.yaml +41 -0
  245. package/src/clis/linux-do/category.yaml +49 -0
  246. package/src/clis/linux-do/hot.yaml +50 -0
  247. package/src/clis/linux-do/latest.yaml +40 -0
  248. package/src/clis/linux-do/search.yaml +45 -0
  249. package/src/clis/linux-do/topic.yaml +38 -0
  250. package/src/clis/neteasemusic/README.md +31 -0
  251. package/src/clis/neteasemusic/README.zh-CN.md +31 -0
  252. package/src/clis/neteasemusic/like.ts +28 -0
  253. package/src/clis/neteasemusic/lyrics.ts +53 -0
  254. package/src/clis/neteasemusic/next.ts +30 -0
  255. package/src/clis/neteasemusic/play.ts +30 -0
  256. package/src/clis/neteasemusic/playing.ts +62 -0
  257. package/src/clis/neteasemusic/playlist.ts +51 -0
  258. package/src/clis/neteasemusic/prev.ts +29 -0
  259. package/src/clis/neteasemusic/search.ts +58 -0
  260. package/src/clis/neteasemusic/status.ts +18 -0
  261. package/src/clis/neteasemusic/volume.ts +61 -0
  262. package/src/clis/notion/README.md +29 -0
  263. package/src/clis/notion/README.zh-CN.md +29 -0
  264. package/src/clis/notion/export.ts +36 -0
  265. package/src/clis/notion/favorites.ts +87 -0
  266. package/src/clis/notion/new.ts +39 -0
  267. package/src/clis/notion/read.ts +33 -0
  268. package/src/clis/notion/search.ts +54 -0
  269. package/src/clis/notion/sidebar.ts +44 -0
  270. package/src/clis/notion/status.ts +18 -0
  271. package/src/clis/notion/write.ts +45 -0
  272. package/src/clis/twitter/download.ts +227 -0
  273. package/src/clis/wechat/README.md +28 -0
  274. package/src/clis/wechat/README.zh-CN.md +28 -0
  275. package/src/clis/wechat/chats.ts +33 -0
  276. package/src/clis/wechat/contacts.ts +33 -0
  277. package/src/clis/wechat/read.ts +72 -0
  278. package/src/clis/wechat/search.ts +36 -0
  279. package/src/clis/wechat/send.ts +49 -0
  280. package/src/clis/wechat/status.ts +35 -0
  281. package/src/clis/xiaohongshu/creator-note-detail.ts +95 -0
  282. package/src/clis/xiaohongshu/creator-notes.ts +116 -0
  283. package/src/clis/xiaohongshu/creator-profile.ts +60 -0
  284. package/src/clis/xiaohongshu/creator-stats.ts +81 -0
  285. package/src/clis/xiaohongshu/download.ts +173 -0
  286. package/src/clis/xiaohongshu/search.ts +1 -1
  287. package/src/clis/xiaohongshu/user-helpers.test.ts +106 -0
  288. package/src/clis/xiaohongshu/user-helpers.ts +85 -0
  289. package/src/clis/xiaohongshu/user.ts +52 -32
  290. package/src/clis/zhihu/download.test.ts +12 -0
  291. package/src/clis/zhihu/download.ts +223 -0
  292. package/src/daemon.ts +217 -0
  293. package/src/doctor.test.ts +32 -193
  294. package/src/doctor.ts +74 -668
  295. package/src/download/index.ts +395 -0
  296. package/src/download/progress.ts +125 -0
  297. package/src/engine.test.ts +17 -0
  298. package/src/main.ts +18 -26
  299. package/src/pipeline/executor.test.ts +1 -0
  300. package/src/pipeline/registry.ts +2 -0
  301. package/src/pipeline/steps/browser.ts +2 -2
  302. package/src/pipeline/steps/download.ts +310 -0
  303. package/src/pipeline/steps/intercept.ts +1 -2
  304. package/src/pipeline/template.ts +26 -0
  305. package/src/setup.ts +47 -183
  306. package/src/types.ts +1 -0
  307. 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 自动发现接口 · 80+ 命令 · 19 站点
4
+ > 零风控 · 复用 Chrome 登录 · AI 自动发现接口 · 浏览器与桌面端自动化
5
5
 
6
6
  [English](./README.md)
7
7
 
@@ -9,7 +9,7 @@
9
9
  [![Node.js Version](https://img.shields.io/node/v/@jackwener/opencli?style=flat-square)](https://nodejs.org)
10
10
  [![License](https://img.shields.io/npm/l/@jackwener/opencli?style=flat-square)](./LICENSE)
11
11
 
12
- OpenCLI 将任何网站或 Electron 应用(如 Antigravity)变成命令行工具 — B站、知乎、小红书、Twitter/X、Reddit、YouTube 等 [19 个站点](#内置命令) — 复用浏览器登录态,AI 驱动探索。
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 等 19 个站点,80+ 命令
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**: >= 18.0.0
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 通过 Playwright MCP Bridge 扩展与你的浏览器通信。
53
- 它会优先复用本地或全局已安装的 `@playwright/mcp`,如果没有嗅探到可用 MCP server,则会自动回退到 `npx -y @playwright/mcp@latest` 启动。
53
+ OpenCLI 通过轻量化的 **Browser Bridge** Chrome 扩展 + 微型 daemon 与浏览器通信(零配置,自动启动)。
54
54
 
55
- ### Playwright MCP Bridge 扩展配置
55
+ ### Browser Bridge 扩展配置
56
56
 
57
- 1. 安装 **[Playwright MCP Bridge](https://chromewebstore.google.com/detail/playwright-mcp-bridge/mmlmfjhmonkocbjadbfplnigmagldckm)** 扩展
58
- 2. 运行 `opencli setup` — 自动发现 Token、分发到各工具、验证连通性:
57
+ 1. Chrome 中安装 **opencli Browser Bridge** 扩展:
58
+ - 打开 `chrome://extensions`,启用右上角的 **开发者模式**
59
+ - 点击 **加载已解压的扩展程序**,选择本仓库的 `extension/` 文件夹
60
+ 2. 完成!运行任何浏览器命令时 daemon 会自动启动。无需 token,无需手动配置。
59
61
 
60
- ```bash
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 # 只读 Token 与配置诊断
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
- **26 个站点 · 128 命令** — 运行 `opencli list` 查看完整注册表。
148
-
149
- | 站点 | 命令 | 数量 | 模式 |
150
- |------|------|:----:|------|
151
- | **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` | 18 | 🔐 浏览器 |
152
- | **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 15 | 🔐 浏览器 |
153
- | **antigravity** | `status` `send` `read` `new` `evaluate` | 5 | 🖥️ 桌面端 |
154
- | **chatgpt** | `status` `new` `send` `read` `ask` | 5 | 🖥️ 桌面端 |
155
- | **codex** | `status` `send` `read` `new` `extract-diff` `model` `ask` `screenshot` `history` `export` | 10 | 🖥️ 桌面端 |
156
- | **cursor** | `status` `send` `read` `new` `dump` `composer` `model` `extract-code` `ask` `screenshot` `history` `export` | 12 | 🖥️ 桌面端 |
157
- | **bilibili** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `dynamic` `ranking` `following` `user-videos` | 11 | 🔐 浏览器 |
158
- | **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | 6 | 🌐 / 🔐 |
159
- | **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 6 | 🔐 浏览器 |
160
- | **xiaohongshu** | `search` `notifications` `feed` `me` `user` | 5 | 🔐 浏览器 |
161
- | **xiaoyuzhou** | `podcast` `podcast-episodes` `episode` | 3 | 🌐 公开 |
162
- | **youtube** | `search` `video` `transcript` | 3 | 🔐 浏览器 |
163
- | **zhihu** | `hot` `search` `question` | 3 | 🔐 浏览器 |
164
- | **boss** | `search` `detail` | 2 | 🔐 浏览器 |
165
- | **coupang** | `search` `add-to-cart` | 2 | 🔐 浏览器 |
166
- | **bbc** | `news` | 1 | 🌐 公共 API |
167
- | **ctrip** | `search` | 1 | 🔐 浏览器 |
168
- | **github** | `search` | 1 | 🌐 公共 API |
169
- | **hackernews** | `top` | 1 | 🌐 公共 API |
170
- | **linkedin** | `search` | 1 | 🔐 浏览器 |
171
- | **reuters** | `search` | 1 | 🔐 浏览器 |
172
- | **smzdm** | `search` | 1 | 🔐 浏览器 |
173
- | **weibo** | `hot` | 1 | 🔐 浏览器 |
174
- | **yahoo-finance** | `quote` | 1 | 🔐 浏览器 |
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
- - **"Failed to connect to Playwright MCP Bridge"** 报错
218
- - 确保你当前的 Chrome 已安装且**开启了** Playwright MCP Bridge 浏览器插件。
219
- - 如果是刚装完插件,需要重启 Chrome 浏览器。
241
+ - **"Extension not connected" 报错**
242
+ - 确保你当前的 Chrome 已安装且**开启了** opencli Browser Bridge 扩展(在 `chrome://extensions` 中检查)。
220
243
  - **返回空数据,或者报错 "Unauthorized"**
221
- - Chrome 里的登录态可能已经过期(甚至被要求过滑动验证码)。请打开当前 Chrome 页面,在新标签页重新手工登录或刷新该页面。
244
+ - Chrome 里的登录态可能已经过期。请打开当前 Chrome 页面,在新标签页重新手工登录或刷新该页面。
222
245
  - **Node API 错误 (如 parseArgs, fs 等)**
223
- - 确保 Node.js 版本 `>= 18`。旧版不支持我们使用的现代核心库 API。
224
- - **Token 问题**
225
- - 运行 `opencli doctor` 诊断所有工具的 Token 配置状态。
226
- - 使用 `opencli doctor --live` 测试浏览器连通性。
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, mcp, playwright, bilibili, zhihu, twitter, github, v2ex, hackernews, reddit, xiaohongshu, xueqiu, youtube, boss, coupang, AI, agent]
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 发现工作流(必须使用 Playwright MCP Bridge 浏览器探索)、5 级认证策略决策树、平台 SDK 速查表、`tap` 步骤调试流程、分页 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. [Playwright MCP Bridge](https://chromewebstore.google.com/detail/playwright-mcp-bridge/mmlmfjhmonkocbjadbfplnigmagldckm) extension installed
38
- 3. Run `opencli setup` to auto-discover token and configure all tools
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 浏览器探索工作流(必须用 Playwright MCP 抓包验证 API)② 认证策略决策树 ③ 平台 SDK(如 Bilibili 的 `apiGet`/`fetchJson`)④ YAML vs TS 选择指南 ⑤ `tap` 步骤调试方法 ⑥ 级联请求模板 ⑦ 常见陷阱表。
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
- | `PLAYWRIGHT_MCP_EXTENSION_TOKEN` | — | Auto-approve extension connection |
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
- | `Timed out connecting to browser` | 1) Chrome must be open 2) Install MCP Bridge extension and configure token |
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 JSON string (MCP parsing) or data path is wrong |
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
- - `PLAYWRIGHT_MCP_EXTENSION_TOKEN` 时,opencli 自动启动一个独立浏览器实例
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 登录态 + 设置 `PLAYWRIGHT_MCP_EXTENSION_TOKEN`,手动跑对应测试
111
+ - 如需测试完整登录态,保持 Chrome 登录态并安装 Browser Bridge 扩展,手动跑对应测试
112
112
 
113
113
  ---
114
114
 
@@ -202,12 +202,12 @@ steps:
202
202
 
203
203
  ## 浏览器模式
204
204
 
205
- opencli 根据 `PLAYWRIGHT_MCP_EXTENSION_TOKEN` 环境变量自动选择模式:
205
+ opencli 通过 Browser Bridge 扩展连接浏览器:
206
206
 
207
- | 条件 | 模式 | MCP 参数 | 使用场景 |
208
- |---|---|---|---|
209
- | Token 已设置 | Extension 模式 | `--extension` | 本地用户,连接已登录的 Chrome |
210
- | Token 未设置 | Standalone 模式 | (无特殊 flag) | CI 或无扩展环境,自启浏览器 |
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 and argument building.
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 { execSync } from 'node:child_process';
5
- import * as fs from 'node:fs';
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
- * Chrome 144+ auto-discovery: read DevToolsActivePort file to get CDP endpoint.
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 discoverChromeEndpoint(): string | null;
21
- export declare function resolveCdpEndpoint(): {
22
- endpoint?: string;
23
- requestedCdp: boolean;
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
+ }>;