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
16 changes: 15 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ dist/
*.log
.DS_Store

# Local env / secrets
.env
.env.*
!.env.example
!.env.*.example

# Browserbase local state and sensitive session artifacts.
# The supported config path is ~/.opencli/browserbase.json; keep any copied
# project-local credentials, proxy passwords, Live View URLs, and connect URLs
# out of the repository.
browserbase*.json
*.browserbase.json
browserbase-sessions/

# VitePress
docs/.vitepress/dist
docs/.vitepress/cache
Expand All @@ -16,10 +30,10 @@ docs/.vitepress/cache
*.pem
*.crx
*.zip
.envrc
.windsurf
.claude
.cortex
.envrc

# Database files
*.db
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,27 @@ When the site you need is not yet covered, use the `opencli-adapter-author` skil
| `OPENCLI_BROWSER_COMMAND_TIMEOUT` | `60` | Seconds to wait for a single browser command |
| `OPENCLI_CDP_ENDPOINT` | — | Chrome DevTools Protocol endpoint for remote browser or Electron apps |
| `OPENCLI_CDP_TARGET` | — | Filter CDP targets by URL substring (e.g. `detail.1688.com`) |
| `BROWSERBASE_API_KEY` | — | API key for validating Browserbase cloud browser sessions |
| `BROWSERBASE_SESSION_ID` | — | Browserbase session ID for adapter browser commands; equivalent to root `--session <id>` |
| `BROWSERBASE_API_KEY` | — | API key for Browserbase cloud browser sessions, contexts, and account profiles |
| `BROWSERBASE_PROJECT_ID` | — | Browserbase project id required for context/account operations |
| `BROWSERBASE_SESSION_ID` | — | Existing Browserbase session ID for adapter browser commands; equivalent to root `--browserbase-session <id>` / legacy `--session <id>` |
| `OPENCLI_VERBOSE` | `false` | Enable verbose logging (`-v` flag also works) |
| `DEBUG_SNAPSHOT` | — | Set to `1` for DOM snapshot debug output |

`opencli browser *` requires an explicit `<session>` positional, uses a foreground browser window by default, and keeps that session's tab lease until `opencli browser <session> close` or idle cleanup. Browser-backed adapters use a background adapter window and release one-shot tab leases by default. Interactive adapters can declare `siteSession: 'persistent'` to keep a stable site tab for continuity; pass `--site-session ephemeral` for a one-shot tab.

For cloud browsers, create a Browserbase session with the `bb` CLI, set `BROWSERBASE_API_KEY`, then run adapter commands with `opencli --session <browserbase-session-id> <site> <command> ...`.
For cloud browsers, OpenCLI can manage Browserbase account profiles, persistent
Contexts, proxy bindings, Live View login sessions, and parallel session pools:
`opencli browserbase account bootstrap ...`,
`opencli --browserbase-account <name> <site> <command> ...`, and
`opencli run --browserbase ...`. Existing Browserbase sessions still work with
`--browserbase-session` or legacy `--session`. See
[`docs/advanced/browserbase.md`](./docs/advanced/browserbase.md).

Social comment workflows are documented in
[`docs/adapters/social-comments.md`](./docs/adapters/social-comments.md),
including Twitter/X, YouTube, Reddit, LinkedIn, Instagram, TikTok, and
Xiaohongshu support.

## Built-in Commands

| Site | Commands |
Expand All @@ -190,6 +203,9 @@ For cloud browsers, create a Browserbase session with the `bb` CLI, set `BROWSER
| **linkedin** | `connect` `inbox` `safe-send` `search` `sent-invitations` `thread-snapshot` `timeline` `salesnav-search` `salesnav-inbox` `salesnav-message` `salesnav-thread` |
| **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `get-comments` `user` `user-posts` `user-comments` `upvote` `upvoted` `save` `saved` `comment` `reply` `subscribe` `subscribed` |
| **twitter** | `trending` `search` `timeline` `tweets` `lists` `list-tweets` `list-add` `list-create` `list-remove` `bookmarks` `post` `download` `profile` `article` `like` `likes` `notifications` `device-follow` `get-comments` `reply` `reply-dm` `thread` `follow` `unfollow` `followers` `following` `block` `unblock` `bookmark` `unbookmark` `delete` `hide-reply` `accept` |
| **youtube** | `search` `video` `transcript` `comments` `reply` `reply-comment` `channel` `playlist` `feed` `history` `watch-later` `subscriptions` `like` `unlike` `subscribe` `unsubscribe` |
| **instagram** | `explore` `profile` `search` `search-posts` `user` `followers` `following` `follow` `unfollow` `like` `unlike` `comment` `get-comments` `reply` `save` `unsave` `saved` |
| **tiktok** | `explore` `search` `profile` `user` `following` `follow` `unfollow` `like` `unlike` `comment` `get-comments` `reply` `save` `unsave` `live` `notifications` `friends` |
| **claude** | `ask` `send` `new` `status` `read` `history` `detail` |
| **gemini** | `new` `ask` `image` `deep-research` `deep-research-result` |
| **notebooklm** | `status` `list` `open` `current` `get` `history` `summary` `note-list` `notes-get` `source-list` `source-get` `source-fulltext` `source-guide` |
Expand Down
16 changes: 13 additions & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,34 @@ Agent 在内部自动处理所有 `opencli browser` 命令——你只需用自
| `OPENCLI_BROWSER_COMMAND_TIMEOUT` | `60` | 单个浏览器命令超时(秒) |
| `OPENCLI_CDP_ENDPOINT` | — | Chrome DevTools Protocol 端点,用于远程浏览器或 Electron 应用 |
| `OPENCLI_CDP_TARGET` | — | 按 URL 子串过滤 CDP target(如 `detail.1688.com`) |
| `BROWSERBASE_API_KEY` | — | Browserbase 云端浏览器、Context 和账号配置所需 API key |
| `BROWSERBASE_PROJECT_ID` | — | Browserbase context/account 操作所需 project id |
| `BROWSERBASE_SESSION_ID` | — | 现有 Browserbase session ID;等价于根参数 `--browserbase-session <id>` / 兼容参数 `--session <id>` |
| `OPENCLI_VERBOSE` | `false` | 启用详细日志(`-v` 也可以) |
| `DEBUG_SNAPSHOT` | — | 设为 `1` 输出 DOM 快照调试信息 |

`opencli browser *` 必须紧跟一个 `<session>` 位置参数,默认使用前台窗口,并保留该 session 的 tab lease,直到你手动执行 `opencli browser <session> close` 或等空闲超时。浏览器型 adapter 默认使用后台 adapter 窗口并在命令结束后释放一次性 tab lease;如果需要调试最终页面,可以传 `--window foreground --keep-tab true`。

Browserbase 现在可以由 OpenCLI 直接管理账号配置、持久 Context、账号绑定 proxy、Live View 登录 session 和并发任务池:`opencli browserbase account bootstrap ...`、`opencli --browserbase-account <name> <site> <command> ...`、`opencli run --browserbase ...`。已有 Browserbase session 仍可用 `--browserbase-session` 或兼容的 `--session`。详见 [`docs/advanced/browserbase.md`](./docs/advanced/browserbase.md)。

社交平台评论能力见 [`docs/adapters/social-comments.md`](./docs/adapters/social-comments.md),覆盖 Twitter/X、YouTube、Reddit、LinkedIn、Instagram、TikTok 和小红书。

## 内置命令

运行 `opencli list` 查看完整注册表。

| 站点 | 命令 |
|------|------|
| **xiaohongshu** | `search` `note` `comments` `notifications` `feed` `user` `download` `publish` `creator-notes` `creator-note-detail` `creator-notes-summary` `creator-profile` `creator-stats` |
| **xiaohongshu** | `search` `note` `comments` `reply` `notifications` `feed` `user` `download` `publish` `creator-notes` `creator-note-detail` `creator-notes-summary` `creator-profile` `creator-stats` `delete-note` |
| **bilibili** | `hot` `search` `me` `favorite` `history` `feed` `subtitle` `summary` `video` `comments` `dynamic` `ranking` `following` `user-videos` `download` |
| **zhihu** | `hot` `search` `question` `download` `follow` `like` `favorite` `comment` `answer` |
| **hackernews** | `top` `new` `best` `ask` `show` `jobs` `search` `user` |
| **linkedin** | `connect` `inbox` `safe-send` `search` `people-search` `sent-invitations` `thread-snapshot` `timeline` `salesnav-search` `salesnav-inbox` `salesnav-message` `salesnav-thread` |
| **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` |
| **twitter** | `trending` `search` `timeline` `tweets` `lists` `list-tweets` `list-add` `list-remove` `bookmarks` `profile` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `likes` `article` `follow` `unfollow` `bookmark` `unbookmark` `download` `accept` `reply-dm` `block` `unblock` `hide-reply` |
| **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `get-comments` `user` `user-posts` `user-comments` `upvote` `save` `comment` `reply` `subscribe` `subscribed` `saved` `upvoted` |
| **twitter** | `trending` `search` `timeline` `tweets` `lists` `list-tweets` `list-add` `list-remove` `bookmarks` `profile` `thread` `get-comments` `following` `followers` `notifications` `post` `reply` `delete` `like` `likes` `article` `follow` `unfollow` `bookmark` `unbookmark` `download` `accept` `reply-dm` `block` `unblock` `hide-reply` |
| **youtube** | `search` `video` `transcript` `comments` `reply` `reply-comment` `channel` `playlist` `feed` `history` `watch-later` `subscriptions` `like` `unlike` `subscribe` `unsubscribe` |
| **instagram** | `explore` `profile` `search` `search-posts` `user` `followers` `following` `follow` `unfollow` `like` `unlike` `comment` `get-comments` `reply` `save` `unsave` `saved` |
| **tiktok** | `explore` `search` `profile` `user` `following` `follow` `unfollow` `like` `unlike` `comment` `get-comments` `reply` `save` `unsave` `live` `notifications` `friends` |
| **claude** | `ask` `send` `new` `status` `read` `history` `detail` |
| **gemini** | `new` `ask` `image` `deep-research` `deep-research-result` |
| **notebooklm** | `status` `list` `open` `current` `get` `history` `summary` `note-list` `notes-get` `source-list` `source-get` `source-fulltext` `source-guide` |
Expand Down
2 changes: 2 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default defineConfig({
text: 'Adapters Overview',
items: [
{ text: 'All Adapters', link: '/adapters/' },
{ text: 'Social Comments', link: '/adapters/social-comments' },
],
},
{
Expand Down Expand Up @@ -190,6 +191,7 @@ export default defineConfig({
{ text: 'Chrome DevTools Protocol', link: '/advanced/cdp' },
{ text: 'Electron Apps', link: '/advanced/electron' },
{ text: 'Remote Chrome', link: '/advanced/remote-chrome' },
{ text: 'Browserbase', link: '/advanced/browserbase' },
{ text: 'Download Support', link: '/advanced/download' },
],
},
Expand Down
18 changes: 18 additions & 0 deletions docs/adapters/browser/instagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
| `opencli instagram search` | Search users |
| `opencli instagram user` | Get recent posts from a user |
| `opencli instagram explore` | Discover trending posts |
| `opencli instagram get-comments` | Get comments on a post with reply-able IDs |
| `opencli instagram comment` | Comment on a post |
| `opencli instagram reply` | Reply to a specific comment |
| `opencli instagram followers` | List user's followers |
| `opencli instagram following` | List user's following |
| `opencli instagram saved` | Get your saved posts (or one collection) |
Expand Down Expand Up @@ -38,6 +41,14 @@ opencli instagram following nasa --limit 20
# Get your saved posts (default "All posts" feed)
opencli instagram saved --limit 10

# Read comments from a post URL, or from a user's Nth recent post
opencli instagram get-comments https://www.instagram.com/p/SHORTCODE/ --limit 50
opencli instagram get-comments nasa --index 1 --limit 20

# Write comments and replies
opencli instagram comment nasa "Great post" --index 1
opencli instagram reply nasa 18000000000000000 "Thanks" --index 1

# Get posts from a specific collection (case-insensitive name match)
opencli instagram saved --collection inspiration --limit 10

Expand All @@ -59,6 +70,13 @@ opencli instagram profile nasa -f json
- `instagram collection-delete <name-or-id>` calls `POST /api/v1/collections/{id}/delete/`. Pass either a case-insensitive collection name or a numeric `collection_id`. If the name resolves to multiple collections (e.g. duplicates from `collection-create`), the adapter throws and lists the candidate ids so you can disambiguate by passing the id explicitly. Unknown names list the available collections in the error message.
- Saving an existing post directly into a named collection in one shot is not exposed by the web app's documented endpoints (`/api/v1/web/save/{pk}/save/` only writes to "All posts"). Use `instagram save` first, then move the post in the UI, or extend with the `/api/v1/collections/{id}/edit/` mutation.

### Comments

`get-comments` returns `comment_id`, `author`, `text`, `likes`,
`replies_count`, and `time`. It accepts a post/reel URL or a username plus
`--index` (`1` is the most recent post). `reply` expects the `comment_id` from
`get-comments`; `comment` and `reply` require a logged-in browser session.

## Prerequisites

- Chrome running and **logged into** instagram.com
Expand Down
8 changes: 8 additions & 0 deletions docs/adapters/browser/linkedin.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ Returns `rank`, `name`, `headline`, `location`, and `profile_url` from the rende

`thread-snapshot` opens an exact messaging thread URL, validates `--max-scrolls` before navigation, scrolls for available history, and returns a JSON snapshot suitable for caller-side recipient safety checks.

### Timeline comments

`timeline` returns each visible feed post with a numeric `comments` count. This
is the current LinkedIn comment surface in OpenCLI: it is useful for ranking and
triage, but it does not extract comment-thread text and does not expose
comment-write commands. Treat LinkedIn comment-thread automation as unsupported
until a dedicated `linkedin comments` adapter exists.

### Sales Navigator commands

`salesnav-search` uses the Sales Navigator lead search API and returns `rank`, `name`, `title`, `company`, `location`, `degree`, `profile_url`, `lead_url`, and `recipient_urn`. Missing lead identity or malformed API payloads fail typed instead of emitting unaddressable rows.
Expand Down
8 changes: 8 additions & 0 deletions docs/adapters/browser/reddit.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| `opencli reddit subreddit` | Posts from a specific subreddit, with sort and time filters |
| `opencli reddit subreddit-info` | **Subreddit metadata (subscribers, active, NSFW, created, description)** |
| `opencli reddit read` | Read a post thread with comments |
| `opencli reddit get-comments` | Flat top-level comments with reply-able IDs |
| `opencli reddit user` | View a user profile |
| `opencli reddit user-posts` | A user's submitted posts |
| `opencli reddit user-comments` | A user's comments |
Expand Down Expand Up @@ -54,6 +55,9 @@ opencli reddit read 1abc123 --depth 2
# Read with "more comments" expansion via /api/morechildren.json
opencli reddit read 1abc123 --depth 3 --expand-more --expand-rounds 3

# Get reply-able comment IDs for automation
opencli reddit get-comments 1abc123 --sort old --limit 100

# Comment on a post
opencli reddit comment 1abc123 "Great post"

Expand Down Expand Up @@ -86,6 +90,10 @@ itself rejects the request with 401/403, that's surfaced as
`AuthRequiredError` because writeable/expand endpoints often require a logged-
in session even though the post listing is public.

`get-comments` is optimized for follow-up automation: it returns `comment_id`,
`author`, `score`, `text`, `replies_count`, and `time` for up to 100 top-level
comments. Use `read --expand-more` when you need the threaded conversation tree.

## Prerequisites

- Chrome running and **logged into** reddit.com
Expand Down
Loading
Loading