@xbrowser/cli 1.22.0 → 1.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -3
- package/dist/{chunk-PIWNMC36.js → chunk-A3MORKYR.js} +1 -1
- package/dist/{chunk-OMU63E6J.js → chunk-FBQZ3PVD.js} +5 -8
- package/dist/chunk-LFX24QJZ.js +9076 -0
- package/dist/{chunk-TEXCXIBW.js → chunk-LPW6QS4M.js} +5 -8
- package/dist/chunk-TBSS7ES4.js +8732 -0
- package/dist/{chunk-NKW4A74J.js → chunk-W44UXZSC.js} +9 -105
- package/dist/cli.js +717 -9155
- package/dist/daemon-main.js +6 -6
- package/dist/{human-interaction-ZUTR5AC2.js → human-interaction-67K43B4O.js} +1 -1
- package/dist/{human-interaction-Y5IDH6LD.js → human-interaction-DK6QGYNC.js} +2 -1
- package/dist/{human-interaction-4YR2N6R6.js → human-interaction-MXST5ZQM.js} +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.js +857 -9588
- package/dist/{plugin-singleton-FCNDN3FX.js → plugin-singleton-GJO7EZXB.js} +1 -1
- package/dist/{recovery-NXC35EQN.js → recovery-67DMH2OM.js} +3 -3
- package/dist/{recovery-L5GLDX4O.js → recovery-6RI2FE3E.js} +4 -3
- package/dist/{recovery-MDWAVXE4.js → recovery-LGY25LIM.js} +1 -1
- package/dist/server-DZUIBVVR.js +243 -0
- package/dist/server-HU4F5KN7.js +240 -0
- package/dist/{session-replayer-XM5L7LFD.js → session-replayer-N665T3G5.js} +22 -17
- package/package.json +11 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# xbrowser
|
|
2
2
|
|
|
3
|
-
> **Browser automation CLI** for web scraping, headless browsing, SEO analysis, and AI agent workflows.
|
|
3
|
+
> **Browser automation CLI** for web scraping, headless browsing, SEO analysis, and AI agent workflows. 57 commands, 132 plugins. A command-line alternative to Playwright, Puppeteer, and Selenium — **no code required**.
|
|
4
4
|
|
|
5
5
|
[](https://github.com/dyyz1993/xbrowser/actions)
|
|
6
6
|
[](https://codecov.io/gh/dyyz1993/xbrowser)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## 特性
|
|
11
11
|
|
|
12
|
-
- **
|
|
12
|
+
- **57 浏览器命令** — 导航、交互、查询、存储、截图,覆盖常见自动化场景
|
|
13
13
|
- **命令链** — 用 `&&`、`,`、`+`、`->`、`;` 串联多个命令,一行搞定复杂流程
|
|
14
14
|
- **管道 & Heredoc** — 支持 stdin 管道和 heredoc 批量执行
|
|
15
15
|
- **录制 / 回放** — 录制浏览器操作为 YAML,随时回放,可转换为 JS/Python/Bash 脚本
|
|
@@ -57,6 +57,22 @@ xbrowser juejin publish --file article.md
|
|
|
57
57
|
# (Each platform has its own plugin — run `xbrowser plugin list` to see available)
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
**Content Marketing — xbrowser promotes itself (dogfooding)**
|
|
61
|
+
```bash
|
|
62
|
+
# Browse the built-in promo case library (self-healing replay, CLI for AI agents, stealth…)
|
|
63
|
+
xbrowser content cases
|
|
64
|
+
|
|
65
|
+
# Render a case into a platform-ready article (en/zh, {{VAR}} substituted)
|
|
66
|
+
xbrowser content draft --case self-healing-replay --lang zh
|
|
67
|
+
|
|
68
|
+
# Render an OG cover image with the browser itself — zero imaging libraries
|
|
69
|
+
xbrowser "set-viewport 1200 630 && content cover --title 'Self-Healing Replay' --output cover.png"
|
|
70
|
+
|
|
71
|
+
# Publish through any of the 18 platform plugins
|
|
72
|
+
xbrowser devto publish --file output/content/self-healing-replay-en.md --tags "typescript,automation"
|
|
73
|
+
```
|
|
74
|
+
The full write → cover → publish loop that promotes xbrowser is itself built on xbrowser commands.
|
|
75
|
+
|
|
60
76
|
## 快速开始
|
|
61
77
|
|
|
62
78
|
### 安装
|
|
@@ -458,6 +474,19 @@ project > browser > page > element
|
|
|
458
474
|
Error: 需要活跃的页面,请先执行 xbrowser goto <url>
|
|
459
475
|
```
|
|
460
476
|
|
|
477
|
+
## MCP Server(AI Agent 接入)
|
|
478
|
+
|
|
479
|
+
xbrowser 内置 Model Context Protocol 服务器——让 Claude Desktop / Cursor / 任何 MCP 客户端直接使用浏览器能力:
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
# 注册到 Claude Code
|
|
483
|
+
claude mcp add xbrowser -- xbrowser mcp
|
|
484
|
+
|
|
485
|
+
# 或手动配置(stdio):command: xbrowser, args: ["mcp"]
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
7 个工具:`browser_navigate` / `browser_act` / `browser_read` / `browser_snapshot`(accessibility tree,token 友好)/ `browser_screenshot` / `browser_network` / `browser_replay`(自愈回放)。协议冒烟:`node scripts/mcp-smoke.mjs`。
|
|
489
|
+
|
|
461
490
|
## 插件系统
|
|
462
491
|
|
|
463
492
|
### 插件加载顺序
|
|
@@ -546,6 +575,7 @@ xbrowser 自带以下插件:
|
|
|
546
575
|
| **douyin** | `ai-summary`, `user-info`, `video-info` | 抖音视频信息提取 |
|
|
547
576
|
| **github** | `update-profile`, `add-social-link`, `create-gist`, `get-profile` | GitHub 个人资料管理 |
|
|
548
577
|
| **web-automation** | `extract`, `paginate`, `fill-and-submit`, `screenshot` | 通用 Web 自动化工具 |
|
|
578
|
+
| **content** | `cases`, `draft`, `cover` | 内容营销:内置推广 case 渲染成文 + 浏览器自渲染封面 |
|
|
549
579
|
|
|
550
580
|
使用插件命令:
|
|
551
581
|
|
|
@@ -884,7 +914,7 @@ xbrowser/
|
|
|
884
914
|
| **Setup** | `npm i -g` — 0 config | Install + browser download | Install + browser download | Install + WebDriver + drivers |
|
|
885
915
|
| **Web Scraping** | Built-in (`scrape`, `crawl`, `map`) | Write custom scripts | Write custom scripts | Write custom scripts |
|
|
886
916
|
| **Search** | Built-in multi-engine (`search`) | No | No | No |
|
|
887
|
-
| **Plugin Ecosystem** |
|
|
917
|
+
| **Plugin Ecosystem** | 132 plugins | Limited | Limited | No |
|
|
888
918
|
| **No Code Required** | ✅ CLI commands | ❌ Must write JS/TS | ❌ Must write JS/TS | ❌ Must write code |
|
|
889
919
|
| **Headless Mode** | ✅ Default | ✅ | ✅ | ✅ |
|
|
890
920
|
| **Record/Replay** | ✅ Built-in (`record`/`replay`) | ✅ Codegen | ❌ | ❌ |
|
|
@@ -95,7 +95,7 @@ import { join } from "path";
|
|
|
95
95
|
import { execSync } from "child_process";
|
|
96
96
|
var SHARED_PLUGIN_DEPENDENCIES = {
|
|
97
97
|
"zod": "^3.24.0",
|
|
98
|
-
"@dyyz1993/xcli-core": "^0.
|
|
98
|
+
"@dyyz1993/xcli-core": "^0.19.0"
|
|
99
99
|
};
|
|
100
100
|
function ensurePluginDependencies(pluginsDir) {
|
|
101
101
|
const zodPath = join(pluginsDir, "node_modules", "zod");
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-HBMEFSTB.js";
|
|
5
5
|
|
|
6
6
|
// src/human-interaction.ts
|
|
7
|
-
import {
|
|
7
|
+
import { execFile } from "child_process";
|
|
8
8
|
|
|
9
9
|
// src/captcha-detector.ts
|
|
10
10
|
var CAPTCHA_SELECTORS = [
|
|
@@ -138,11 +138,6 @@ var WebhookNotifier = class {
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
// src/utils/shell-escape.ts
|
|
142
|
-
function shellEscape(value) {
|
|
143
|
-
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
141
|
// src/human-interaction.ts
|
|
147
142
|
var HumanInteractionManager = class {
|
|
148
143
|
wsServer;
|
|
@@ -171,8 +166,10 @@ var HumanInteractionManager = class {
|
|
|
171
166
|
tryAutoOpen(previewUrl) {
|
|
172
167
|
if (!this.autoOpen) return;
|
|
173
168
|
try {
|
|
174
|
-
const
|
|
175
|
-
|
|
169
|
+
const opener = process.platform === "darwin" ? "open" : process.platform === "linux" ? "xdg-open" : "cmd";
|
|
170
|
+
const args = process.platform === "win32" ? ["/c", "start", "", previewUrl] : [previewUrl];
|
|
171
|
+
execFile(opener, args, { timeout: 1e4 }, () => {
|
|
172
|
+
});
|
|
176
173
|
} catch {
|
|
177
174
|
}
|
|
178
175
|
}
|