@jackwener/opencli 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # OpenCLI
2
2
 
3
3
  > **Make any website your CLI.**
4
- > Zero risk · Reuse Chrome login · AI-powered discovery
4
+ > Zero risk · Reuse Chrome login · AI-powered discovery · 80+ commands · 19 sites
5
5
 
6
6
  [中文文档](./README.zh-CN.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
- A CLI tool that turns **any website** into a command-line interface — bilibili, zhihu, xiaohongshu, twitter, reddit, and many more — powered by browser session reuse and AI-native discovery.
12
+ A CLI tool that turns **any website** into a command-line interface — Bilibili, Zhihu, 小红书, Twitter/X, Reddit, YouTube, and [many more](#built-in-commands) — powered by browser session reuse and AI-native discovery.
13
13
 
14
14
  ---
15
15
 
@@ -32,8 +32,9 @@ A CLI tool that turns **any website** into a command-line interface — bilibili
32
32
 
33
33
  - **Account-safe** — Reuses Chrome's logged-in state; your credentials never leave the browser.
34
34
  - **AI Agent ready** — `explore` discovers APIs, `synthesize` generates adapters, `cascade` finds auth strategies.
35
+ - **Self-healing setup** — `opencli setup` auto-discovers tokens; `opencli doctor` diagnoses config across 10+ tools; `--fix` repairs them all.
35
36
  - **Dynamic Loader** — Simply drop `.ts` or `.yaml` adapters into the `clis/` folder for auto-registration.
36
- - **Dual-Engine Architecture** — Supports both YAML declarative data pipelines and robust browser runtime typescript injections.
37
+ - **Dual-Engine Architecture** — Supports both YAML declarative data pipelines and robust browser runtime TypeScript injections.
37
38
 
38
39
  ## Prerequisites
39
40
 
@@ -47,7 +48,7 @@ OpenCLI connects to your browser through the Playwright MCP Bridge extension.
47
48
  ### Playwright MCP Bridge Extension Setup
48
49
 
49
50
  1. Install **[Playwright MCP Bridge](https://chromewebstore.google.com/detail/playwright-mcp-bridge/mmlmfjhmonkocbjadbfplnigmagldckm)** extension in Chrome.
50
- 2. Run `opencli setup` — it auto-discovers your token and lets you choose which tools to configure:
51
+ 2. Run `opencli setup` — discovers the token, distributes it to your tools, and verifies connectivity:
51
52
 
52
53
  ```bash
53
54
  opencli setup
@@ -57,6 +58,15 @@ The interactive TUI will:
57
58
  - 🔍 Auto-discover `PLAYWRIGHT_MCP_EXTENSION_TOKEN` from Chrome (no manual copy needed)
58
59
  - ☑️ Show all detected tools (Codex, Cursor, Claude Code, Gemini CLI, etc.)
59
60
  - ✏️ Update only the files you select (Space to toggle, Enter to confirm)
61
+ - 🔌 Auto-verify browser connectivity after writing configs
62
+
63
+ > **Tip**: Use `opencli doctor` for ongoing diagnosis and maintenance:
64
+ > ```bash
65
+ > opencli doctor # Read-only token & config diagnosis
66
+ > opencli doctor --live # Also test live browser connectivity
67
+ > opencli doctor --fix # Fix mismatched configs (interactive)
68
+ > opencli doctor --fix -y # Fix all configs non-interactively
69
+ > ```
60
70
 
61
71
  <details>
62
72
  <summary>Manual setup (alternative)</summary>
@@ -85,12 +95,6 @@ export PLAYWRIGHT_MCP_EXTENSION_TOKEN="<your-token-here>"
85
95
 
86
96
  </details>
87
97
 
88
- Verify with `opencli doctor` — shows colored status for all config locations:
89
-
90
- ```bash
91
- opencli doctor
92
- ```
93
-
94
98
  ## Quick Start
95
99
 
96
100
  ### Install via npm (recommended)
@@ -130,27 +134,29 @@ npm install -g @jackwener/opencli@latest
130
134
 
131
135
  ## Built-in Commands
132
136
 
133
- | Site | Commands | Mode |
134
- |------|----------|------|
135
- | **bilibili** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `dynamic` `ranking` `following` `user-videos` | 🔐 Browser |
136
- | **zhihu** | `hot` `search` `question` | 🔐 Browser |
137
- | **xiaohongshu** | `search` `notifications` `feed` `user` | 🔐 Browser |
138
- | **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 🔐 Browser |
139
- | **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` | 🔐 Browser |
140
- | **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 🔐 Browser |
141
- | **weibo** | `hot` | 🔐 Browser |
142
- | **boss** | `search` `detail` | 🔐 Browser |
143
- | **coupang** | `search` `add-to-cart` | 🔐 Browser |
144
- | **youtube** | `search` `video` `transcript` | 🔐 Browser |
145
- | **linkedin** | `search` | 🔐 Browser |
146
- | **yahoo-finance** | `quote` | 🔐 Browser |
147
- | **reuters** | `search` | 🔐 Browser |
148
- | **smzdm** | `search` | 🔐 Browser |
149
- | **ctrip** | `search` | 🔐 Browser |
150
- | **github** | `search` | 🌐 Public |
151
- | **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | 🌐 Public / 🔐 Browser |
152
- | **hackernews** | `top` | 🌐 Public |
153
- | **bbc** | `news` | 🌐 Public |
137
+ **19 sites · 80+ commands** run `opencli list` for the live registry.
138
+
139
+ | Site | Commands | Count | Mode |
140
+ |------|----------|:-----:|------|
141
+ | **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` | 18 | 🔐 Browser |
142
+ | **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 15 | 🔐 Browser |
143
+ | **bilibili** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `dynamic` `ranking` `following` `user-videos` | 11 | 🔐 Browser |
144
+ | **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | 6 | 🌐 / 🔐 |
145
+ | **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 6 | 🔐 Browser |
146
+ | **xiaohongshu** | `search` `notifications` `feed` `me` `user` | 5 | 🔐 Browser |
147
+ | **youtube** | `search` `video` `transcript` | 3 | 🔐 Browser |
148
+ | **zhihu** | `hot` `search` `question` | 3 | 🔐 Browser |
149
+ | **boss** | `search` `detail` | 2 | 🔐 Browser |
150
+ | **coupang** | `search` `add-to-cart` | 2 | 🔐 Browser |
151
+ | **bbc** | `news` | 1 | 🌐 Public |
152
+ | **ctrip** | `search` | 1 | 🔐 Browser |
153
+ | **github** | `search` | 1 | 🌐 Public |
154
+ | **hackernews** | `top` | 1 | 🌐 Public |
155
+ | **linkedin** | `search` | 1 | 🔐 Browser |
156
+ | **reuters** | `search` | 1 | 🔐 Browser |
157
+ | **smzdm** | `search` | 1 | 🔐 Browser |
158
+ | **weibo** | `hot` | 1 | 🔐 Browser |
159
+ | **yahoo-finance** | `quote` | 1 | 🔐 Browser |
154
160
 
155
161
  ## Output Formats
156
162
 
@@ -195,7 +201,7 @@ Explore outputs to `.opencli/explore/<site>/` (manifest.json, endpoints.json, ca
195
201
 
196
202
  See **[TESTING.md](./TESTING.md)** for the full testing guide, including:
197
203
 
198
- - Current test coverage (unit + ~52 E2E tests across all 18 sites)
204
+ - Current test coverage (unit + E2E tests across 19 sites)
199
205
  - How to run tests locally
200
206
  - How to add tests when creating new adapters
201
207
  - CI/CD pipeline with sharding
package/README.zh-CN.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # OpenCLI
2
2
 
3
3
  > **把任何网站变成你的命令行工具。**
4
- > 零风控 · 复用 Chrome 登录 · AI 自动发现接口
4
+ > 零风控 · 复用 Chrome 登录 · AI 自动发现接口 · 80+ 命令 · 19 站点
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 将任何网站变成命令行工具 — B站、知乎、小红书、Twitter、Reddit 等众多站点 — 复用浏览器登录态,AI 驱动探索。
12
+ OpenCLI 将任何网站变成命令行工具 — B站、知乎、小红书、Twitter/X、Reddit、YouTube [19 个站点](#内置命令) — 复用浏览器登录态,AI 驱动探索。
13
13
 
14
14
  ---
15
15
 
@@ -29,8 +29,9 @@ OpenCLI 将任何网站变成命令行工具 — B站、知乎、小红书、Twi
29
29
 
30
30
  ## 亮点
31
31
 
32
- - **多站点覆盖** — B站、知乎、小红书、Twitter、Reddit 等众多站点
32
+ - **多站点覆盖** — B站、知乎、小红书、Twitter、Reddit 等 19 个站点,80+ 命令
33
33
  - **零风控** — 复用 Chrome 登录态,无需存储任何凭证
34
+ - **自修复配置** — `opencli setup` 自动发现 Token;`opencli doctor` 诊断 10+ 工具配置;`--fix` 一键修复
34
35
  - **AI 原生** — `explore` 自动发现 API,`synthesize` 生成适配器,`cascade` 探测认证策略
35
36
  - **动态加载引擎** — 声明式的 `.yaml` 或者底层定制的 `.ts` 适配器,放入 `clis/` 文件夹即可自动注册生效
36
37
 
@@ -46,7 +47,7 @@ OpenCLI 通过 Playwright MCP Bridge 扩展与你的浏览器通信。
46
47
  ### Playwright MCP Bridge 扩展配置
47
48
 
48
49
  1. 安装 **[Playwright MCP Bridge](https://chromewebstore.google.com/detail/playwright-mcp-bridge/mmlmfjhmonkocbjadbfplnigmagldckm)** 扩展
49
- 2. 运行 `opencli setup` — 自动发现 Token 并让你选择要配置哪些工具:
50
+ 2. 运行 `opencli setup` — 自动发现 Token、分发到各工具、验证连通性:
50
51
 
51
52
  ```bash
52
53
  opencli setup
@@ -56,6 +57,15 @@ opencli setup
56
57
  - 🔍 从 Chrome 自动发现 `PLAYWRIGHT_MCP_EXTENSION_TOKEN`(无需手动复制)
57
58
  - ☑️ 显示所有支持的工具(Codex、Cursor、Claude Code、Gemini CLI 等)
58
59
  - ✏️ 只更新你选中的文件(空格切换,回车确认)
60
+ - 🔌 完成后自动验证浏览器连通性
61
+
62
+ > **Tip**:后续诊断和维护用 `opencli doctor`:
63
+ > ```bash
64
+ > opencli doctor # 只读 Token 与配置诊断
65
+ > opencli doctor --live # 额外测试浏览器连通性
66
+ > opencli doctor --fix # 修复不一致的配置(交互确认)
67
+ > opencli doctor --fix -y # 无交互直接修复所有配置
68
+ > ```
59
69
 
60
70
  <details>
61
71
  <summary>手动配置(备选方案)</summary>
@@ -84,12 +94,6 @@ export PLAYWRIGHT_MCP_EXTENSION_TOKEN="<你的-token>"
84
94
 
85
95
  </details>
86
96
 
87
- 配置后运行 `opencli doctor` 检查所有位置的 Token 状态:
88
-
89
- ```bash
90
- opencli doctor
91
- ```
92
-
93
97
  ## 快速开始
94
98
 
95
99
  ### npm 全局安装(推荐)
@@ -129,27 +133,29 @@ npm install -g @jackwener/opencli@latest
129
133
 
130
134
  ## 内置命令
131
135
 
132
- | 站点 | 命令 | 模式 |
133
- |------|------|------|
134
- | **bilibili** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `dynamic` `ranking` `following` `user-videos` | 🔐 浏览器 |
135
- | **zhihu** | `hot` `search` `question` | 🔐 浏览器 |
136
- | **xiaohongshu** | `search` `notifications` `feed` `user` | 🔐 浏览器 |
137
- | **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 🔐 浏览器 |
138
- | **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` | 🔐 浏览器 |
139
- | **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 🔐 浏览器 |
140
- | **weibo** | `hot` | 🔐 浏览器 |
141
- | **boss** | `search` `detail` | 🔐 浏览器 |
142
- | **coupang** | `search` `add-to-cart` | 🔐 浏览器 |
143
- | **youtube** | `search` | 🔐 浏览器 |
144
- | **linkedin** | `search` | 🔐 浏览器 |
145
- | **yahoo-finance** | `quote` | 🔐 浏览器 |
146
- | **reuters** | `search` | 🔐 浏览器 |
147
- | **smzdm** | `search` | 🔐 浏览器 |
148
- | **ctrip** | `search` | 🔐 浏览器 |
149
- | **github** | `search` | 🌐 公共 API |
150
- | **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | 🌐 公共 API / 🔐 浏览器 |
151
- | **hackernews** | `top` | 🌐 公共 API |
152
- | **bbc** | `news` | 🌐 公共 API |
136
+ **19 个站点 · 80+ 命令** 运行 `opencli list` 查看完整注册表。
137
+
138
+ | 站点 | 命令 | 数量 | 模式 |
139
+ |------|------|:----:|------|
140
+ | **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` | 18 | 🔐 浏览器 |
141
+ | **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 15 | 🔐 浏览器 |
142
+ | **bilibili** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `dynamic` `ranking` `following` `user-videos` | 11 | 🔐 浏览器 |
143
+ | **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | 6 | 🌐 / 🔐 |
144
+ | **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 6 | 🔐 浏览器 |
145
+ | **xiaohongshu** | `search` `notifications` `feed` `me` `user` | 5 | 🔐 浏览器 |
146
+ | **youtube** | `search` `video` `transcript` | 3 | 🔐 浏览器 |
147
+ | **zhihu** | `hot` `search` `question` | 3 | 🔐 浏览器 |
148
+ | **boss** | `search` `detail` | 2 | 🔐 浏览器 |
149
+ | **coupang** | `search` `add-to-cart` | 2 | 🔐 浏览器 |
150
+ | **bbc** | `news` | 1 | 🌐 公共 API |
151
+ | **ctrip** | `search` | 1 | 🔐 浏览器 |
152
+ | **github** | `search` | 1 | 🌐 公共 API |
153
+ | **hackernews** | `top` | 1 | 🌐 公共 API |
154
+ | **linkedin** | `search` | 1 | 🔐 浏览器 |
155
+ | **reuters** | `search` | 1 | 🔐 浏览器 |
156
+ | **smzdm** | `search` | 1 | 🔐 浏览器 |
157
+ | **weibo** | `hot` | 1 | 🔐 浏览器 |
158
+ | **yahoo-finance** | `quote` | 1 | 🔐 浏览器 |
153
159
 
154
160
  ## 输出格式
155
161
 
@@ -201,6 +207,7 @@ opencli cascade https://api.example.com/data
201
207
  - 确保 Node.js 版本 `>= 18`。旧版不支持我们使用的现代核心库 API。
202
208
  - **Token 问题**
203
209
  - 运行 `opencli doctor` 诊断所有工具的 Token 配置状态。
210
+ - 使用 `opencli doctor --live` 测试浏览器连通性。
204
211
 
205
212
  ## 版本发布
206
213
 
package/SKILL.md CHANGED
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: opencli
3
- description: "OpenCLI — Make any website your CLI. Zero risk, AI-powered, reuse Chrome login."
4
- version: 0.7.0
3
+ description: "OpenCLI — Make any website your CLI. Zero risk, AI-powered, reuse Chrome login. 80+ commands across 19 sites."
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, AI, agent]
6
+ tags: [cli, browser, web, mcp, playwright, bilibili, zhihu, twitter, github, v2ex, hackernews, reddit, xiaohongshu, xueqiu, youtube, boss, coupang, AI, agent]
7
7
  ---
8
8
 
9
9
  # OpenCLI
@@ -68,6 +68,7 @@ opencli zhihu question --id 34816524 # 问题详情和回答
68
68
  opencli xiaohongshu search --keyword "美食" # 搜索笔记
69
69
  opencli xiaohongshu notifications # 通知(mentions/likes/connections)
70
70
  opencli xiaohongshu feed --limit 10 # 推荐 Feed
71
+ opencli xiaohongshu me # 我的信息
71
72
  opencli xiaohongshu user --uid xxx # 用户主页
72
73
 
73
74
  # 雪球 Xueqiu (browser)
@@ -131,6 +132,7 @@ opencli weibo hot --limit 10 # 微博热搜
131
132
 
132
133
  # BOSS直聘 (browser)
133
134
  opencli boss search --query "AI agent" # 搜索职位
135
+ opencli boss detail --securityId xxx # 职位详情
134
136
 
135
137
  # YouTube (browser)
136
138
  opencli youtube search --query "rust" # 搜索视频
@@ -160,8 +162,10 @@ opencli list -f yaml # YAML output
160
162
  opencli validate # Validate all CLI definitions
161
163
  opencli validate bilibili # Validate specific site
162
164
  opencli setup # Interactive token setup (auto-discover + TUI checkbox)
163
- opencli doctor # Diagnose token config across all tools
164
- opencli doctor --fix -y # Auto-fix all config files (non-interactive)
165
+ opencli doctor # Diagnose token & extension config across all tools
166
+ opencli doctor --live # Also test live browser connectivity
167
+ opencli doctor --fix # Fix mismatched configs (interactive confirmation)
168
+ opencli doctor --fix -y # Fix all configs non-interactively
165
169
  ```
166
170
 
167
171
  ### AI Agent Workflow
package/dist/doctor.d.ts CHANGED
@@ -2,6 +2,7 @@ export declare const PLAYWRIGHT_TOKEN_ENV = "PLAYWRIGHT_MCP_EXTENSION_TOKEN";
2
2
  export type DoctorOptions = {
3
3
  fix?: boolean;
4
4
  yes?: boolean;
5
+ live?: boolean;
5
6
  shellRc?: string;
6
7
  configPaths?: string[];
7
8
  token?: string;
@@ -23,16 +24,24 @@ export type McpConfigStatus = {
23
24
  writable: boolean;
24
25
  parseError?: string;
25
26
  };
27
+ export type ConnectivityResult = {
28
+ ok: boolean;
29
+ error?: string;
30
+ durationMs: number;
31
+ };
26
32
  export type DoctorReport = {
27
33
  cliVersion?: string;
28
34
  envToken: string | null;
29
35
  envFingerprint: string | null;
30
36
  extensionToken: string | null;
31
37
  extensionFingerprint: string | null;
38
+ extensionInstalled: boolean;
39
+ extensionBrowsers: string[];
32
40
  shellFiles: ShellFileStatus[];
33
41
  configs: McpConfigStatus[];
34
42
  recommendedToken: string | null;
35
43
  recommendedFingerprint: string | null;
44
+ connectivity?: ConnectivityResult;
36
45
  warnings: string[];
37
46
  issues: string[];
38
47
  };
@@ -41,8 +50,8 @@ export declare function toolName(p: string): string;
41
50
  export declare function getDefaultShellRcPath(): string;
42
51
  export declare function getDefaultMcpConfigPaths(cwd?: string): string[];
43
52
  export declare function readTokenFromShellContent(content: string): string | null;
44
- export declare function upsertShellToken(content: string, token: string): string;
45
- export declare function upsertJsonConfigToken(content: string, token: string): string;
53
+ export declare function upsertShellToken(content: string, token: string, filePath?: string): string;
54
+ export declare function upsertJsonConfigToken(content: string, token: string, filePath?: string): string;
46
55
  export declare function readTomlConfigToken(content: string): string | null;
47
56
  export declare function upsertTomlConfigToken(content: string, token: string): string;
48
57
  export declare function fileExists(filePath: string): boolean;
@@ -50,10 +59,28 @@ export declare function fileExists(filePath: string): boolean;
50
59
  * Discover the auth token stored by the Playwright MCP Bridge extension
51
60
  * by scanning Chrome's LevelDB localStorage files directly.
52
61
  *
53
- * Uses `strings` + `grep` for fast binary scanning on macOS/Linux,
54
- * with a pure-Node fallback on Windows.
62
+ * Reads LevelDB .ldb/.log files as raw binary and searches for the
63
+ * extension ID near base64url token values. This works reliably across
64
+ * platforms because LevelDB's internal encoding can split ASCII strings
65
+ * like "auth-token" and the extension ID across byte boundaries, making
66
+ * text-based tools like `strings` + `grep` unreliable.
55
67
  */
56
68
  export declare function discoverExtensionToken(): string | null;
69
+ /**
70
+ * Check whether the Playwright MCP Bridge extension is installed in any browser.
71
+ * Scans Chrome/Chromium/Edge Extensions directories for the known extension ID.
72
+ */
73
+ export declare function checkExtensionInstalled(): {
74
+ installed: boolean;
75
+ browsers: string[];
76
+ };
77
+ /**
78
+ * Test token connectivity by attempting a real MCP connection.
79
+ * Connects, does the JSON-RPC handshake, and immediately closes.
80
+ */
81
+ export declare function checkTokenConnectivity(opts?: {
82
+ timeout?: number;
83
+ }): Promise<ConnectivityResult>;
57
84
  export declare function runBrowserDoctor(opts?: DoctorOptions): Promise<DoctorReport>;
58
85
  export declare function renderBrowserDoctorReport(report: DoctorReport): string;
59
86
  export declare function writeFileWithMkdir(filePath: string, content: string): void;