Skip to content

Commit 7776db8

Browse files
authored
docs: consolidate adapter docs and discovery loading (#212)
1 parent fae1dce commit 7776db8

32 files changed

Lines changed: 114 additions & 457 deletions

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[![Node.js Version](https://img.shields.io/node/v/@jackwener/opencli?style=flat-square)](https://nodejs.org)
1010
[![License](https://img.shields.io/npm/l/@jackwener/opencli?style=flat-square)](./LICENSE)
1111

12-
A CLI tool that turns **any website** or **Electron app** into a command-line interface — Bilibili, Zhihu, 小红书, Twitter/X, Reddit, YouTube, Antigravity, and [many more](#built-in-commands) — powered by browser session reuse and AI-native discovery.
12+
A CLI tool that turns **any website**, **Electron app**, or **local CLI tool** into a command-line interface — Bilibili, Zhihu, 小红书, Twitter/X, Reddit, YouTube, Antigravity, `gh`, `docker`, and [many more](#built-in-commands) — powered by browser session reuse and AI-native discovery.
1313

1414
**Built for AI Agents**: Simply configure an instruction in your global `AGENT.md` or `.cursorrules` guiding the AI to execute `opencli list` via Bash to discover available tools. Register your favorite local CLIs (`opencli register mycli`), and the AI will automatically learn how to invoke all your tools perfectly!
1515

@@ -25,6 +25,7 @@ Turn ANY Electron application into a CLI tool! Recombine, script, and extend app
2525
- [Quick Start](#quick-start)
2626
- [Built-in Commands](#built-in-commands)
2727
- [Desktop App Adapters](#desktop-app-adapters)
28+
- [External CLI Hub](#external-cli-hub)
2829
- [Download Support](#download-support)
2930
- [Output Formats](#output-formats)
3031
- [For AI Agents (Developer Guide)](#for-ai-agents-developer-guide)
@@ -128,7 +129,7 @@ Run `opencli list` for the live registry.
128129
| **discord-app** | `status` `send` `read` `channels` `servers` `search` `members` | Desktop |
129130
| **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | Public / Browser |
130131
| **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | Browser |
131-
| **antigravity** | `status` `send` `read` `new` `dump` `extract-code` `model` `watch` | Desktop |
132+
| **antigravity** | `status` `send` `read` `new` `dump` `extract-code` `model` `watch` `serve` | Desktop |
132133
| **chatgpt** | `status` `new` `send` `read` `ask` | Desktop |
133134
| **xiaohongshu** | `search` `notifications` `feed` `user` `download` `creator-notes` `creator-note-detail` `creator-notes-summary` `creator-profile` `creator-stats` | Browser |
134135
| **apple-podcasts** | `search` `episodes` `top` | Public |

README.zh-CN.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[![Node.js Version](https://img.shields.io/node/v/@jackwener/opencli?style=flat-square)](https://nodejs.org)
1010
[![License](https://img.shields.io/npm/l/@jackwener/opencli?style=flat-square)](./LICENSE)
1111

12-
OpenCLI 将任何网站或 Electron 应用(如 Antigravity)变成命令行工具 — B站、知乎、小红书、Twitter/X、Reddit、YouTube[多种站点与应用](#内置命令) — 复用浏览器登录态,AI 驱动探索。
12+
OpenCLI 将任何网站、本地 CLI 或 Electron 应用(如 Antigravity)变成命令行工具 — B站、知乎、小红书、Twitter/X、Reddit、YouTube,以及 `gh``docker`[多种站点与工具](#内置命令) — 复用浏览器登录态,AI 驱动探索。
1313

1414
**专为 AI Agent 打造**:只需在全局 `.cursorrules``AGENT.md` 中配置简单指令,引导 AI 通过 Bash 执行 `opencli list` 来检索可用的 CLI 工具及其用法。随后,将你常用的 CLI 列表整合注册进去(`opencli register mycli`),AI 便能瞬间学会自动调用相应的本地工具!
1515

@@ -27,6 +27,7 @@ CLI all electron!现在支持把所有 electron 应用 CLI 化,从而组合
2727
- [快速开始](#快速开始)
2828
- [内置命令](#内置命令)
2929
- [桌面应用适配器](#桌面应用适配器)
30+
- [外部 CLI 枢纽](#外部-cli-枢纽)
3031
- [下载支持](#下载支持)
3132
- [输出格式](#输出格式)
3233
- [致 AI Agent(开发者指南)](#致-ai-agent开发者指南)
@@ -42,6 +43,7 @@ CLI all electron!现在支持把所有 electron 应用 CLI 化,从而组合
4243
- **CLI All Electron** — 支持把所有 electron 应用(如 Antigravity Ultra)CLI 化,让 AI 控制自己!
4344
- **多站点覆盖** — 覆盖 B站、知乎、小红书、Twitter、Reddit,以及多种桌面应用
4445
- **零风控** — 复用 Chrome 登录态,无需存储任何凭证
46+
- **外部 CLI 枢纽** — 统一发现、自动安装、透传执行 `gh``docker``kubectl` 等本地 CLI
4547
- **自修复配置**`opencli setup` 检查 Browser Bridge 连通性;`opencli doctor` 诊断 daemon、扩展和浏览器连接状态
4648
- **AI 原生**`explore` 自动发现 API,`synthesize` 生成适配器,`cascade` 探测认证策略
4749
- **动态加载引擎** — 声明式的 `.yaml` 或者底层定制的 `.ts` 适配器,放入 `clis/` 文件夹即可自动注册生效
@@ -128,7 +130,7 @@ npm install -g @jackwener/opencli@latest
128130
| **discord-app** | `status` `send` `read` `channels` `servers` `search` `members` | 桌面端 |
129131
| **v2ex** | `hot` `latest` `topic` `daily` `me` `notifications` | 公开 / 浏览器 |
130132
| **xueqiu** | `feed` `hot-stock` `hot` `search` `stock` `watchlist` | 浏览器 |
131-
| **antigravity** | `status` `send` `read` `new` `dump` `extract-code` `model` `watch` | 桌面端 |
133+
| **antigravity** | `status` `send` `read` `new` `dump` `extract-code` `model` `watch` `serve` | 桌面端 |
132134
| **chatgpt** | `status` `new` `send` `read` `ask` | 桌面端 |
133135
| **xiaohongshu** | `search` `notifications` `feed` `user` `download` `creator-notes` `creator-note-detail` `creator-notes-summary` `creator-profile` `creator-stats` | 浏览器 |
134136
| **apple-podcasts** | `search` `episodes` `top` | 公开 |
@@ -162,22 +164,44 @@ npm install -g @jackwener/opencli@latest
162164

163165
> **Bloomberg 说明**:Bloomberg 的 RSS 列表命令(`main`、各栏目 feed、`feeds`)无需浏览器即可使用。`bloomberg news` 适用于当前 Chrome 会话本身就能访问的标准 Bloomberg 文章页。音频页和部分非标准页面可能失败,OpenCLI 也不会绕过 Bloomberg 的付费墙、登录或权限校验。
164166
167+
### 外部 CLI 枢纽
168+
169+
OpenCLI 也可以作为你现有命令行工具的统一入口,负责发现、自动安装和纯透传执行。
170+
171+
| 外部 CLI | 描述 | 示例 |
172+
|----------|------|------|
173+
| **gh** | GitHub CLI | `opencli gh pr list --limit 5` |
174+
| **obsidian** | Obsidian 仓库管理 | `opencli obsidian search query="AI"` |
175+
| **docker** | Docker 命令行工具 | `opencli docker ps` |
176+
| **kubectl** | Kubernetes CLI | `opencli kubectl get pods` |
177+
| **readwise** | Readwise / Reader CLI | `opencli readwise login` |
178+
179+
**零配置透传**:OpenCLI 会把你的输入原样转发给底层二进制,保留原生 stdout / stderr 行为。
180+
181+
**自动安装**:如果你运行 `opencli gh ...` 时系统中还没有 `gh`,OpenCLI 会优先尝试通过系统包管理器安装,然后自动重试命令。
182+
183+
**注册自定义本地 CLI**
184+
185+
```bash
186+
opencli register mycli
187+
```
188+
165189
### 桌面应用适配器
166190

167191
每个桌面适配器都有自己详细的文档说明,包括命令参考、启动配置与使用示例:
168192

169193
| 应用 | 描述 | 文档 |
170194
|-----|-------------|-----|
171-
| **Cursor** | 控制 Cursor IDE — Composer、对话、代码提取等 | [README](./src/clis/cursor/README.md) |
172-
| **Codex** | 在后台(无头)驱动 OpenAI Codex CLI Agent | [README](./src/clis/codex/README.md) |
173-
| **Antigravity** | 在终端直接控制 Antigravity Ultra | [README](./src/clis/antigravity/README.md) |
174-
| **ChatGPT** | 自动化操作 ChatGPT macOS 桌面客户端 | [README](./src/clis/chatgpt/README.md) |
175-
| **ChatWise** | 多 LLM 客户端(GPT-4、Claude、Gemini) | [README](./src/clis/chatwise/README.md) |
176-
| **Notion** | 搜索、读取、写入 Notion 页面 | [README](./src/clis/notion/README.md) |
177-
| **Discord** | Discord 桌面版 — 消息、频道、服务器 | [README](./src/clis/discord-app/README.md) |
178-
| **Feishu** | 飞书/Lark 桌面版 (AppleScript 驱动) | [README](./src/clis/feishu/README.md) |
179-
| **WeChat** | 微信 Mac 桌面端 (AppleScript + 无障碍接口) | [README](./src/clis/wechat/README.md) |
180-
| **NeteaseMusic** | 网易云音乐 (CEF/CDP 驱动) | [README](./src/clis/neteasemusic/README.md) |
195+
| **Cursor** | 控制 Cursor IDE — Composer、对话、代码提取等 | [Doc](./docs/adapters/desktop/cursor.md) |
196+
| **Codex** | 在后台(无头)驱动 OpenAI Codex CLI Agent | [Doc](./docs/adapters/desktop/codex.md) |
197+
| **Antigravity** | 在终端直接控制 Antigravity Ultra | [Doc](./docs/adapters/desktop/antigravity.md) |
198+
| **ChatGPT** | 自动化操作 ChatGPT macOS 桌面客户端 | [Doc](./docs/adapters/desktop/chatgpt.md) |
199+
| **ChatWise** | 多 LLM 客户端(GPT-4、Claude、Gemini) | [Doc](./docs/adapters/desktop/chatwise.md) |
200+
| **Notion** | 搜索、读取、写入 Notion 页面 | [Doc](./docs/adapters/desktop/notion.md) |
201+
| **Discord** | Discord 桌面版 — 消息、频道、服务器 | [Doc](./docs/adapters/desktop/discord.md) |
202+
| **Feishu** | 飞书/Lark 桌面版 (AppleScript 驱动) | [Doc](./docs/adapters/desktop/feishu.md) |
203+
| **WeChat** | 微信 Mac 桌面端 (AppleScript + 无障碍接口) | [Doc](./docs/adapters/desktop/wechat.md) |
204+
| **NeteaseMusic** | 网易云音乐 (CEF/CDP 驱动) | [Doc](./docs/adapters/desktop/neteasemusic.md) |
181205

182206
## 下载支持
183207

SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,11 @@ opencli antigravity status # 检查 CDP 连接
176176
opencli antigravity send "hello" # 发送文本到当前 agent 聊天框
177177
opencli antigravity read # 读取整个聊天记录面板
178178
opencli antigravity new # 清空聊天、开启新对话
179+
opencli antigravity dump # 导出 DOM 和快照调试信息
179180
opencli antigravity extract-code # 自动抽取 AI 回复中的代码块
180181
opencli antigravity model claude # 切换底层模型
181182
opencli antigravity watch # 流式监听增量消息
183+
opencli antigravity serve --port 8082 # 启动 Anthropic 兼容代理
182184

183185
# Barchart (browser)
184186
opencli barchart quote --symbol AAPL # 股票行情

docs/adapters/desktop/antigravity.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ Scrape the entire current conversation history block as pure text.
3636
### `opencli antigravity new`
3737
Click the "New Conversation" button to instantly clear the UI state and start fresh.
3838

39+
### `opencli antigravity dump`
40+
Dump the current DOM and snapshot artifacts to `/tmp` for reverse-engineering and selector debugging.
41+
3942
### `opencli antigravity extract-code`
4043
Extract any multi-line code blocks from the current conversation view. Ideal for automated script extraction (e.g. `opencli antigravity extract-code > script.sh`).
4144

@@ -44,3 +47,6 @@ Quickly target and switch the active LLM engine. Example: `opencli antigravity m
4447

4548
### `opencli antigravity watch`
4649
A long-running, streaming process that continuously polls the Antigravity UI for chat updates and outputs them in real-time to standard output.
50+
51+
### `opencli antigravity serve --port 8082`
52+
Start an Anthropic-compatible `/v1/messages` proxy backed by the local Antigravity app. Useful when you want external tools to talk to Antigravity through an API-shaped interface.

docs/adapters/desktop/chatgpt.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The current built-in commands use native AppleScript automation — no extra lau
1515
- `opencli chatgpt new`: Activate ChatGPT and press `Cmd+N` to start a new conversation.
1616
- `opencli chatgpt send "message"`: Copy your message to clipboard, activate ChatGPT, paste, and submit.
1717
- `opencli chatgpt read`: Read the last visible message from the focused ChatGPT window via the Accessibility tree.
18+
- `opencli chatgpt ask "message"`: Send a prompt and wait for the visible reply in one shot.
1819

1920
## Approach 2: CDP (Advanced, Electron Debug Mode)
2021

@@ -29,7 +30,7 @@ ChatGPT Desktop is also an Electron app and can be launched with a remote debugg
2930
export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9224"
3031
```
3132

32-
> The CDP approach enables future advanced commands like DOM inspection, model switching, and code extraction.
33+
> The CDP approach is primarily for advanced automation and future desktop-only commands. The built-in command set above still works in the default AppleScript path unless you explicitly route through `OPENCLI_CDP_ENDPOINT`.
3334
3435
## How It Works
3536

docs/adapters/desktop/codex.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@ Control the **OpenAI Codex Desktop App** headless or headfully via Chrome DevToo
1414
## Setup
1515

1616
```bash
17-
export OPENCLI_CODEX_CDP_ENDPOINT="http://127.0.0.1:9222"
17+
export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9222"
1818
```
1919

2020
## Commands
2121

2222
### Diagnostics
2323
- `opencli codex status`: Checks connection and reads the current active window URL/title.
2424
- `opencli codex dump`: Dumps the full UI DOM and Accessibility tree into `/tmp`.
25+
- `opencli codex screenshot`: Captures DOM + snapshot artifacts of the current window.
2526

2627
### Agent Manipulation
2728
- `opencli codex new`: Simulates `Cmd+N` to start a completely fresh and isolated Git Worktree thread context.
2829
- `opencli codex send "message"`: Robustly finds the active Thread Composer and injects your text.
2930
- *Pro-tip*: You can trigger internal shortcuts, e.g., `opencli codex send "/review"`.
31+
- `opencli codex ask "message"`: Send + wait + read in one shot.
3032
- `opencli codex read`: Extracts the entire current thread history and AI reasoning logs.
3133
- `opencli codex extract-diff`: Automatically scrapes any visual Patch chunks and Code Diffs.
3234
- `opencli codex model`: Get the currently active AI model.
35+
- `opencli codex history`: List recent conversation threads from the sidebar.
36+
- `opencli codex export`: Export the current conversation as Markdown.

docs/adapters/desktop/cursor.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9226"
2121
### Diagnostics
2222
- `opencli cursor status`: Check CDP connection status.
2323
- `opencli cursor dump`: Dump the full DOM and Accessibility snapshot to `/tmp/cursor-dom.html` and `/tmp/cursor-snapshot.json`.
24+
- `opencli cursor screenshot`: Capture DOM + snapshot artifacts of the current window.
2425

2526
### Chat Manipulation
2627
- `opencli cursor new`: Press `Cmd+N` to start a new file/tab.
2728
- `opencli cursor send "message"`: Inject text into the active Composer/Chat input and submit.
29+
- `opencli cursor ask "message"`: Send + wait + read in one shot.
2830
- `opencli cursor read`: Extract the full conversation history from the active chat panel.
2931

3032
### AI Features
3133
- `opencli cursor composer "prompt"`: Open the Composer panel (`Cmd+I`) and send a prompt for inline AI editing.
3234
- `opencli cursor model`: Get the currently active AI model (e.g., `claude-4.5-sonnet`).
3335
- `opencli cursor extract-code`: Extract all code blocks from the current conversation.
36+
- `opencli cursor history`: List recent chat/composer sessions from the sidebar.
37+
- `opencli cursor export`: Export the current conversation as Markdown.

docs/adapters/desktop/discord.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9232"
1919

2020
| Command | Description |
2121
|---------|-------------|
22-
| `opencli discord status` | Check CDP connection |
23-
| `opencli discord send "message"` | Send a message in the active channel |
24-
| `opencli discord read` | Read recent messages |
25-
| `opencli discord channels` | List channels in the current server |
26-
| `opencli discord servers` | List all joined servers |
27-
| `opencli discord search "query"` | Search messages (Cmd+F) |
28-
| `opencli discord members` | List online members |
22+
| `opencli discord-app status` | Check CDP connection |
23+
| `opencli discord-app send "message"` | Send a message in the active channel |
24+
| `opencli discord-app read` | Read recent messages |
25+
| `opencli discord-app channels` | List channels in the current server |
26+
| `opencli discord-app servers` | List all joined servers |
27+
| `opencli discord-app search "query"` | Search messages (Cmd+F) |
28+
| `opencli discord-app members` | List online members |

src/clis/antigravity/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/clis/antigravity/README.zh-CN.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)