Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This is the most common type of contribution. Start with YAML when possible, and

### YAML Adapter (Recommended for data-fetching commands)

Create a file like `src/clis/<site>/<command>.yaml`:
Create a file like `clis/<site>/<command>.yaml`:

```yaml
site: mysite
Expand Down Expand Up @@ -66,11 +66,11 @@ pipeline:
columns: [rank, title, score, url]
```

See [`hackernews/top.yaml`](src/clis/hackernews/top.yaml) for a real example.
See [`hackernews/top.yaml`](clis/hackernews/top.yaml) for a real example.

### TypeScript Adapter (For complex browser interactions)

Create a file like `src/clis/<site>/<command>.ts`:
Create a file like `clis/<site>/<command>.ts`:

```typescript
import { cli, Strategy } from '../../src/registry.js';
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ git clone git@github.com:jackwener/opencli.git && cd opencli && npm install && n
| **hupu** | `hot` `search` `detail` `mentions` `reply` `like` `unlike` |
| **twitter** | `trending` `search` `timeline` `bookmarks` `post` `download` `profile` `article` `like` `likes` `notifications` `reply` `reply-dm` `thread` `follow` `unfollow` `followers` `following` `block` `unblock` `bookmark` `unbookmark` `delete` `hide-reply` `accept` |
| **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `upvoted` `save` `saved` `comment` `subscribe` |
| **amazon** | `bestsellers` `search` `product` `offer` `discussion` `movers-shakers` `new-releases` `rankings` |
| **amazon** | `bestsellers` `search` `product` `offer` `discussion` `movers-shakers` `new-releases` |
| **1688** | `search` `item` `store` |
| **gemini** | `new` `ask` `image` `deep-research` `deep-research-result` |
| **yuanbao** | `new` `ask` |
| **notebooklm** | `status` `list` `open` `current` `get` `history` `summary` `note-list` `notes-get` `rpc` `source-list` `source-get` `source-fulltext` `source-guide` |
| **notebooklm** | `status` `list` `open` `current` `get` `history` `summary` `note-list` `notes-get` `source-list` `source-get` `source-fulltext` `source-guide` |
| **spotify** | `auth` `status` `play` `pause` `next` `prev` `volume` `search` `queue` `shuffle` `repeat` |
| **xianyu** | `search` `item` `chat` |
| **xiaoe** | `courses` `detail` `catalog` `play-url` `content` |
Expand Down
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ npx skills add jackwener/opencli --skill opencli-oneshot # 快速命令参
| **douban** | `search` `top250` `subject` `photos` `download` `marks` `reviews` `movie-hot` `book-hot` | 浏览器 |
| **facebook** | `feed` `profile` `search` `friends` `groups` `events` `notifications` `memories` `add-friend` `join-group` | 浏览器 |
| **google** | `news` `search` `suggest` `trends` | 公开 |
| **amazon** | `bestsellers` `search` `product` `offer` `discussion` `movers-shakers` `new-releases` `rankings` | 浏览器 |
| **amazon** | `bestsellers` `search` `product` `offer` `discussion` `movers-shakers` `new-releases` | 浏览器 |
| **1688** | `search` `item` `store` | 浏览器 |
| **gemini** | `new` `ask` `image` `deep-research` `deep-research-result` | 浏览器 |
| **spotify** | `auth` `status` `play` `pause` `next` `prev` `volume` `search` `queue` `shuffle` `repeat` | OAuth API |
| **notebooklm** | `status` `list` `open` `current` `get` `history` `summary` `note-list` `notes-get` `rpc` `source-list` `source-get` `source-fulltext` `source-guide` | 浏览器 |
| **notebooklm** | `status` `list` `open` `current` `get` `history` `summary` `note-list` `notes-get` `source-list` `source-get` `source-fulltext` `source-guide` | 浏览器 |
| **36kr** | `news` `hot` `search` `article` | 公开 / 浏览器 |
| **imdb** | `search` `title` `top` `trending` `person` `reviews` | 公开 |
| **producthunt** | `posts` `today` `hot` `browse` | 公开 / 浏览器 |
Expand Down
6 changes: 3 additions & 3 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ src/
|---|---|
| 核心运行时与输出 | `src/browser.test.ts`, `src/browser/dom-snapshot.test.ts`, `src/build-manifest.test.ts`, `src/capabilityRouting.test.ts`, `src/doctor.test.ts`, `src/engine.test.ts`, `src/interceptor.test.ts`, `src/output.test.ts`, `src/plugin.test.ts`, `src/registry.test.ts`, `src/snapshotFormatter.test.ts` |
| pipeline 与下载 | `src/download/index.test.ts`, `src/pipeline/executor.test.ts`, `src/pipeline/template.test.ts`, `src/pipeline/transform.test.ts` |
| 站点 / adapter 逻辑 | `src/clis/apple-podcasts/commands.test.ts`, `src/clis/apple-podcasts/utils.test.ts`, `src/clis/bloomberg/utils.test.ts`, `src/clis/chaoxing/utils.test.ts`, `src/clis/coupang/utils.test.ts`, `src/clis/google/utils.test.ts`, `src/clis/grok/ask.test.ts`, `src/clis/twitter/timeline.test.ts`, `src/clis/weread/utils.test.ts`, `src/clis/xiaohongshu/creator-note-detail.test.ts`, `src/clis/xiaohongshu/creator-notes-summary.test.ts`, `src/clis/xiaohongshu/creator-notes.test.ts`, `src/clis/xiaohongshu/search.test.ts`, `src/clis/xiaohongshu/user-helpers.test.ts`, `src/clis/xiaoyuzhou/utils.test.ts`, `src/clis/youtube/transcript-group.test.ts`, `src/clis/zhihu/download.test.ts` |
| 站点 / adapter 逻辑 | `clis/apple-podcasts/commands.test.ts`, `clis/apple-podcasts/utils.test.ts`, `clis/bloomberg/utils.test.ts`, `clis/chaoxing/utils.test.ts`, `clis/coupang/utils.test.ts`, `clis/google/utils.test.ts`, `clis/grok/ask.test.ts`, `clis/twitter/timeline.test.ts`, `clis/weread/utils.test.ts`, `clis/xiaohongshu/creator-note-detail.test.ts`, `clis/xiaohongshu/creator-notes-summary.test.ts`, `clis/xiaohongshu/creator-notes.test.ts`, `clis/xiaohongshu/search.test.ts`, `clis/xiaohongshu/user-helpers.test.ts`, `clis/xiaoyuzhou/utils.test.ts`, `clis/youtube/transcript-group.test.ts`, `clis/zhihu/download.test.ts` |

这些测试覆盖的重点包括:

Expand Down Expand Up @@ -110,7 +110,7 @@ npx vitest run tests/e2e/
npx vitest run tests/smoke/

# 单个测试文件
npx vitest run src/clis/apple-podcasts/commands.test.ts
npx vitest run clis/apple-podcasts/commands.test.ts
npx vitest run tests/e2e/management.test.ts

# 全部测试
Expand All @@ -132,7 +132,7 @@ npx vitest src/

## 如何添加新测试

### 新增 YAML Adapter(如 `src/clis/producthunt/trending.yaml`)
### 新增 YAML Adapter(如 `clis/producthunt/trending.yaml`)

1. `opencli validate` 的 E2E / smoke 测试会覆盖 adapter 结构校验
2. 根据 adapter 类型,在对应测试文件补一个 `it()` block
Expand Down
4 changes: 3 additions & 1 deletion docs/adapters/browser/amazon.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
| `opencli amazon product <asin-or-url>` | Read a product page with title, price, rating, breadcrumbs, and bullets |
| `opencli amazon offer <asin-or-url>` | Read seller / fulfillment / buy-box facts from the product page |
| `opencli amazon discussion <asin-or-url>` | Read review summary and sample customer reviews |
| `opencli amazon movers-shakers [<url>]` | Amazon Movers & Shakers pages for short-term growth signals |
| `opencli amazon new-releases [<url>]` | Amazon New Releases pages for early momentum discovery |

## Usage Examples

Expand Down Expand Up @@ -42,7 +44,7 @@ opencli amazon discussion B0FJS72893 --limit 5 -f json
## Notes

- This adapter only returns fields visible on public Amazon pages.
- `bestsellers` and `search` are for candidate discovery; `product`, `offer`, and `discussion` are the validation surfaces.
- `bestsellers`, `movers-shakers`, `new-releases`, and `search` are for candidate discovery; `product`, `offer`, and `discussion` are the validation surfaces.
- `offer` is the right surface for `sold_by`, `ships_from`, and Amazon-retail exclusion.
- `discussion` may return review data even when Q&A is absent. Missing Q&A is a normal outcome, not an error.

Expand Down
2 changes: 2 additions & 0 deletions docs/adapters/browser/gemini.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
| `opencli gemini new` | Start a new Gemini web chat |
| `opencli gemini ask <prompt>` | Send a prompt and return only the assistant reply |
| `opencli gemini image <prompt>` | Generate images in Gemini and optionally save them locally |
| `opencli gemini deep-research <prompt>` | Start a Gemini Deep Research run and confirm it |
| `opencli gemini deep-research-result <query>` | Export Deep Research report URL from a Gemini conversation |

## Usage Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/adapters/browser/notebooklm.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ opencli notebooklm status
opencli notebooklm list -f json
opencli notebooklm open nb-demo -f json
opencli notebooklm current -f json
opencli notebooklm metadata -f json
opencli notebooklm get -f json
opencli notebooklm source-list -f json
opencli notebooklm source-get "Quarterly report" -f json
opencli notebooklm source-guide "Quarterly report" -f json
opencli notebooklm source-fulltext "Quarterly report" -f json
opencli notebooklm history -f json
opencli notebooklm notes-list -f json
opencli notebooklm note-list -f json
opencli notebooklm notes-get "Draft note" -f json
opencli notebooklm summary -f json
```
Expand Down
6 changes: 3 additions & 3 deletions docs/adapters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Run `opencli list` for the live registry.
| **[linux-do](./browser/linux-do)** | `hot` `latest` `feed` `search` `categories` `category` `tags` `topic` `user-posts` `user-topics` | 🔐 Browser |
| **[chaoxing](./browser/chaoxing)** | `assignments` `exams` | 🔐 Browser |
| **[grok](./browser/grok)** | `ask` | 🔐 Browser |
| **[gemini](./browser/gemini)** | `new` `ask` `image` | 🔐 Browser |
| **[gemini](./browser/gemini)** | `new` `ask` `image` `deep-research` `deep-research-result` | 🔐 Browser |
| **[yuanbao](./browser/yuanbao)** | `new` `ask` | 🔐 Browser |
| **[notebooklm](./browser/notebooklm)** | `status` `list` `open` `select` `current` `get` `metadata` `source-list` `source-get` `source-fulltext` `source-guide` `history` `note-list` `notes-list` `notes-get` `summary` | 🔐 Browser |
| **[notebooklm](./browser/notebooklm)** | `status` `list` `open` `current` `get` `source-list` `source-get` `source-fulltext` `source-guide` `history` `note-list` `notes-get` `summary` | 🔐 Browser |
| **[doubao](./browser/doubao)** | `status` `new` `send` `read` `ask` `history` `detail` `meeting-summary` `meeting-transcript` | 🔐 Browser |
| **[weread](./browser/weread)** | `shelf` `search` `book` `ranking` `notebooks` `highlights` `notes` | 🔐 Browser |
| **[douban](./browser/douban)** | `search` `top250` `subject` `photos` `download` `marks` `reviews` `movie-hot` `book-hot` | 🔐 Browser |
Expand All @@ -47,7 +47,7 @@ Run `opencli list` for the live registry.
| **[tiktok](./browser/tiktok)** | `explore` `search` `profile` `user` `following` `follow` `unfollow` `like` `unlike` `comment` `save` `unsave` `live` `notifications` `friends` | 🔐 Browser |
| **[google](./browser/google)** | `news` `search` `suggest` `trends` | 🌐 / 🔐 |
| **[jd](./browser/jd)** | `item` | 🔐 Browser |
| **[amazon](./browser/amazon)** | `bestsellers` `search` `product` `offer` `discussion` | 🔐 Browser |
| **[amazon](./browser/amazon)** | `bestsellers` `search` `product` `offer` `discussion` `movers-shakers` `new-releases` | 🔐 Browser |
| **[1688](./browser/1688)** | `search` `item` `store` | 🔐 Browser |
| **[web](./browser/web)** | `read` | 🔐 Browser |
| **[weixin](./browser/weixin)** | `download` | 🔐 Browser |
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/electron.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ls /Applications/AppName.app/Contents/Frameworks/Electron\ Framework.framework

## The 5-Command Pattern (CDP / Electron)

Every new Electron adapter should implement these 5 commands in `src/clis/<app_name>/`:
Every new Electron adapter should implement these 5 commands in `clis/<app_name>/`:

### 1. `status.ts` — Connection Test
```typescript
Expand Down
6 changes: 3 additions & 3 deletions docs/developer/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Before you start:

### YAML Adapter (Recommended for data-fetching commands)

Create a file like `src/clis/<site>/<command>.yaml`:
Create a file like `clis/<site>/<command>.yaml`:

::: v-pre
```yaml
Expand Down Expand Up @@ -69,11 +69,11 @@ columns: [rank, title, score, url]
```
:::

See [`hackernews/top.yaml`](https://github.com/jackwener/opencli/blob/main/src/clis/hackernews/top.yaml) for a real example.
See [`hackernews/top.yaml`](https://github.com/jackwener/opencli/blob/main/clis/hackernews/top.yaml) for a real example.

### TypeScript Adapter (For complex browser interactions)

Create a file like `src/clis/<site>/<command>.ts`:
Create a file like `clis/<site>/<command>.ts`:

```typescript
import { cli, Strategy } from '../../src/registry.js';
Expand Down
10 changes: 5 additions & 5 deletions docs/developer/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ src/

| 层 | 位置 | 当前文件数 | 运行方式 | 用途 |
|---|---|---:|---|---|
| 单元测试 | `src/**/*.test.ts`(排除 `src/clis/**`) | - | `npm test` | 内部模块、pipeline、runtime |
| Adapter 测试 | `src/clis/{zhihu,twitter,reddit,bilibili}/**/*.test.ts` | - | `npm run test:adapter` | 保留 4 个重点站点的 adapter 覆盖 |
| 单元测试 | `src/**/*.test.ts`(排除 `clis/**`) | - | `npm test` | 内部模块、pipeline、runtime |
| Adapter 测试 | `clis/{zhihu,twitter,reddit,bilibili}/**/*.test.ts` | - | `npm run test:adapter` | 保留 4 个重点站点的 adapter 覆盖 |
| E2E 测试 | `tests/e2e/*.test.ts` | 5 | `npx vitest run tests/e2e/` | 真实 CLI 命令执行 |
| 烟雾测试 | `tests/smoke/*.test.ts` | 1 | `npx vitest run tests/smoke/` | 外部 API 与注册完整性 |

Expand All @@ -51,7 +51,7 @@ src/
|---|---|
| 核心运行时与输出 | `src/browser.test.ts`, `src/browser/dom-snapshot.test.ts`, `src/build-manifest.test.ts`, `src/capabilityRouting.test.ts`, `src/doctor.test.ts`, `src/engine.test.ts`, `src/interceptor.test.ts`, `src/output.test.ts`, `src/plugin.test.ts`, `src/registry.test.ts`, `src/snapshotFormatter.test.ts` |
| pipeline 与下载 | `src/download/index.test.ts`, `src/pipeline/executor.test.ts`, `src/pipeline/template.test.ts`, `src/pipeline/transform.test.ts` |
| 聚焦 adapter 逻辑 | `src/clis/zhihu/download.test.ts`, `src/clis/twitter/timeline.test.ts`, `src/clis/reddit/read.test.ts`, `src/clis/bilibili/dynamic.test.ts` |
| 聚焦 adapter 逻辑 | `clis/zhihu/download.test.ts`, `clis/twitter/timeline.test.ts`, `clis/reddit/read.test.ts`, `clis/bilibili/dynamic.test.ts` |

这些测试覆盖的重点包括:

Expand Down Expand Up @@ -114,7 +114,7 @@ npx vitest run tests/e2e/
npx vitest run tests/smoke/

# 单个测试文件
npx vitest run src/clis/apple-podcasts/commands.test.ts
npx vitest run clis/apple-podcasts/commands.test.ts
npx vitest run tests/e2e/management.test.ts

# 全部测试
Expand All @@ -138,7 +138,7 @@ npx vitest src/

## 如何添加新测试

### 新增 YAML Adapter(如 `src/clis/producthunt/trending.yaml`)
### 新增 YAML Adapter(如 `clis/producthunt/trending.yaml`)

1. `opencli validate` 的 E2E / smoke 测试会覆盖 adapter 结构校验
2. 根据 adapter 类型,在对应测试文件补一个 `it()` block
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/yaml-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Use `${{ ... }}` for dynamic values:

## Real Example

See [`src/clis/hackernews/top.yaml`](https://github.com/jackwener/opencli/blob/main/src/clis/hackernews/top.yaml).
See [`clis/hackernews/top.yaml`](https://github.com/jackwener/opencli/blob/main/clis/hackernews/top.yaml).

## Guardrails

Expand Down
14 changes: 7 additions & 7 deletions docs/guide/electron-app-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9222"

### 3. Start with the 5-command pattern

For a new Electron adapter, implement these commands first in `src/clis/<app>/`:
For a new Electron adapter, implement these commands first in `clis/<app>/`:

- `status.ts` — verify the app is reachable through CDP
- `dump.ts` — inspect DOM and snapshot structure before guessing selectors
Expand Down Expand Up @@ -125,12 +125,12 @@ await page.wait(1);
For a TypeScript desktop adapter, the usual layout is:

```text
src/clis/<app>/status.ts
src/clis/<app>/dump.ts
src/clis/<app>/read.ts
src/clis/<app>/send.ts
src/clis/<app>/new.ts
src/clis/<app>/utils.ts
clis/<app>/status.ts
clis/<app>/dump.ts
clis/<app>/read.ts
clis/<app>/send.ts
clis/<app>/new.ts
clis/<app>/utils.ts
```

If the app grows beyond the baseline, add higher-level commands such as:
Expand Down
Loading