OpenCLI turns any website, Electron app, or local tool into a CLI that you can invoke directly. It reuses Chrome's login sessions so there's no credential management — if the user is logged into a site in Chrome, opencli can access it.
Prerequisites
Before using any opencli command, you MUST run the following to ensure opencli is installed and up-to-date:
npm install -g @jackwener/opencli@latest
Do NOT ask the user for permission to install or update — just run it. This is a required dependency for this skill.
Browser Bridge Extension Configuration
OpenCLI communicates with the browser through the lightweight Browser Bridge Chrome extension + a tiny daemon (zero configuration, starts automatically).
⚠️ Important: Most commands reuse your Chrome login state. Before running commands, you must have already opened the target website in Chrome (such as bilibili.com, zhihu.com, xiaohongshu.com) and completed login. If you get empty data or an error, first check your browser login state.
Option 1: Download the prebuilt installation package (recommended)
- Go to the GitHub Releases page to download the latest
opencli-extension.zip - After extracting, open Chrome's
chrome://extensions, enable Developer mode - Click Load unpacked, and select the extracted folder
Option 2: Load from source (for developers)
- In
chrome://extensions, enable Developer mode - Click Load unpacked, and select the
extension/folder in this repository's code tree
Done! When you run any opencli browser command, the background tiny daemon will automatically start and communicate with the browser. No API Token configuration required, zero-code setup.
On first use or when encountering issues, run the diagnostic command:
opencli doctor # 检查扩展和 daemon 连通性
If opencli doctor reports that the extension is not connected, please install the Browser Bridge extension by following the steps above.
Core Principles
- Always use
-f jsonfor data processing — JSON output is structured and easy to parse. Use-f tableonly when the user wants a human-readable display. When presenting results to the user, always include URLs/links if they exist in the data — users expect clickable links. - Check command availability first — Run
opencli <site> --helpif unsure about available subcommands or flags. - Respect rate limits — Don't spam commands in rapid succession. One request at a time for browser-based commands.
- Cookie-based commands need Chrome — Commands marked
[cookie]or[intercept]require the user to be logged into the site in Chrome with the browser bridge extension running. If a command fails with auth errors, first runopencli doctorto check connectivity, then tell the user to install the extension and log into the target website according to the "Browser Bridge Extension Configuration" section.
Command Pattern
opencli <site> <command> [options]
Common flags:
-f <format>— Output format:json,yaml,table(default),csv,md--limit <n>— Limit number of results--output <dir>— Output directory (for downloads)
Quick Reference by Task
Fetching Trending / Hot Content
opencli bilibili hot --limit 10 # B站热门
opencli zhihu hot --limit 10 # 知乎热榜
opencli weibo hot # 微博热搜
opencli twitter trending # Twitter 趋势
opencli reddit hot --limit 10 # Reddit 热门
opencli hackernews top --limit 10 # HackerNews (public, no login)
opencli v2ex hot # V2EX 热门
opencli xiaohongshu feed # 小红书推荐
opencli tiktok explore # TikTok 热门
opencli xueqiu hot # 雪球热门动态
opencli sinafinance news # 新浪财经快讯
Searching Content
opencli twitter search "query" # 搜索 Twitter
opencli zhihu search "query" # 搜索知乎
opencli bilibili search "query" # 搜索 B站
opencli xiaohongshu search "query" # 搜索小红书
opencli reddit search "query" # 搜索 Reddit
opencli youtube search "query" # 搜索 YouTube
opencli arxiv search "query" # 搜索论文
opencli stackoverflow search "query" # 搜索 Stack Overflow
opencli weread search "query" # 搜索微信读书
opencli substack search "query" # 搜索 Substack
opencli smzdm search "query" # 什么值得买搜索
Downloading Media
opencli xiaohongshu download <note_id> --output ./xhs # 小红书图片/视频
opencli bilibili download <bvid> --output ./bili # B站视频 (需要 yt-dlp)
opencli twitter download <username> --limit 20 # Twitter 媒体
opencli zhihu download "<url>" --download-images # 知乎文章转 Markdown
opencli weixin download "<url>" # 微信公众号文章转 Markdown
Reading Articles / Posts
opencli zhihu question <question_id> # 知乎问题详情
opencli reddit read "<url>" # Reddit 帖子和评论
opencli twitter thread "<url>" # Twitter 线程
opencli bloomberg news "<url>" # Bloomberg 文章
opencli youtube transcript <video_id> # YouTube 字幕
opencli bilibili subtitle <bvid> # B站字幕
Social Actions
opencli twitter post "content" # 发推
opencli twitter like "<tweet_url>" # 点赞
opencli twitter follow "<username>" # 关注
opencli reddit comment "<post_url>" "text" # Reddit 评论
opencli xiaohongshu publish # 发布小红书笔记
Stock / Finance
opencli xueqiu stock <code> # 雪球股票行情
opencli xueqiu search "keyword" # 搜索股票
opencli xueqiu hot-stock # 热门股票
opencli xueqiu watchlist # 自选股
opencli yahoo-finance quote <symbol> # Yahoo Finance 行情
opencli barchart quote <symbol> # Barchart 行情
opencli barchart options <symbol> # 期权链
opencli barchart flow # 异常期权活动
Desktop App Control
# Cursor IDE
opencli cursor status # 检查连接状态
# Notion
opencli notion search "query" # 搜索 Notion
opencli notion read # 读取当前页面
opencli notion new # 新建页面
opencli notion export # 导出为 Markdown
# ChatGPT Desktop
opencli chatgpt ask "prompt" # 发送消息并获取回复
opencli chatgpt new # 新建对话
# Discord
opencli discord-app channels # 列出频道
External CLI Hub
opencli can also uniformly invoke installed external CLIs:
opencli gh pr list --limit 5 # GitHub CLI
opencli docker ps # Docker
opencli kubectl get pods # Kubernetes
Creator Analytics (Xiaohongshu)
opencli xiaohongshu creator-profile # 账号信息
opencli xiaohongshu creator-stats # 数据总览
opencli xiaohongshu creator-notes # 笔记列表+数据
opencli xiaohongshu creator-note-detail <id> # 单篇详情
opencli xiaohongshu creator-notes-summary # 批量摘要
News & Information
opencli bbc news # BBC 新闻
opencli bloomberg main # Bloomberg 头条
opencli bloomberg tech # Bloomberg 科技
opencli reuters search "query" # 路透社搜索
opencli wikipedia trending # 维基百科热门
opencli wikipedia search "query" # 维基百科搜索
opencli apple-podcasts top # Apple 播客排行
Troubleshooting
- "Extension not connected" — first run
opencli doctorfor diagnostics; if the extension is not installed, guide the user to install it according to the "Browser Bridge Extension Configuration" section above - Empty data or 401 — the user needs to open and log into the target website in Chrome (such as bilibili.com, zhihu.com), then refresh the page and retry
- Command not found — run
opencli listto confirm available commands, oropencli <site> --helpto view subcommands - Daemon issues — run
opencli doctorfor automatic diagnosis and repair
Advanced Usage for AI Agents
If the user needs to create a CLI adapter for a new website:
opencli explore <url> --site <name> # 分析网站 API
opencli synthesize <name> # 生成适配器
opencli generate <url> --goal "hot" # 一步到位:探索 + 生成
opencli cascade <url> # 自动降级检测最简策略
Output Format Guidelines
- Show to the user — use
-f table(default) or-f md, good readability - Programmatic processing/analysis — use
-f json, structured data - Export/save — use
-f csv(tabular data) or-f md(article content) - Debugging — use
-f yaml, human-readable structured format