opencli-agent
This skill should be used when the user wants to interact with websites or online services via command-line automation. It enables posting on Twitter/X, brow...
Like a lobster shell, security has layers — review code before you run it.
License
SKILL.md
OpenCLI Agent
Overview / 概述
This skill transforms natural language instructions into opencli commands, enabling automated interaction with 70+ websites and services (Twitter/X, Reddit, Bilibili, Xiaohongshu, YouTube, etc.) directly from the command line. OpenCLI reuses the Chrome browser's login session, so there is no need to expose passwords or API keys.
本技能将自然语言指令转换为 opencli 命令,可自动与 70+ 个网站和服务(Twitter/X、Reddit、B站、小红书、YouTube 等)进行交互。OpenCLI 复用 Chrome 浏览器的登录会话,无需暴露密码或 API 密钥。
Prerequisites Check / 环境检查
Before executing any opencli command, verify the environment is ready by running the setup check script:
在执行任何 opencli 命令之前,先运行环境检查脚本确认环境就绪:
bash {SKILL_DIR}/scripts/check_setup.sh
If the script reports issues, guide the user through the installation steps:
如果脚本报告问题,引导用户完成以下安装步骤:
- Install Node.js / 安装 Node.js (>= 20.0.0):
brew install nodeor visit https://nodejs.org - Install OpenCLI / 安装 OpenCLI:
npm install -g @jackwener/opencli - Install Browser Extension / 安装浏览器扩展:
- Download
opencli-extension.zipfrom https://github.com/jackwener/opencli/releases / 从 GitHub Releases 下载opencli-extension.zip - Open Chrome →
chrome://extensions→ Enable "Developer Mode" / 打开 Chrome →chrome://extensions→ 开启"开发者模式" - Click "Load unpacked" → Select the extracted extension folder / 点击"加载已解压的扩展程序" → 选择解压后的文件夹
- Download
- Login to target websites / 登录目标网站 in Chrome (e.g., log into twitter.com before posting tweets / 例如:发推前先在 Chrome 中登录 twitter.com)
- Verify / 验证: Run
opencli doctorto confirm extension and daemon connectivity / 运行opencli doctor确认扩展和守护进程连接正常
Command Execution Workflow / 命令执行流程
When receiving a user instruction, follow this workflow:
收到用户指令后,按以下流程执行:
Step 1: Parse the Intent / 第一步:解析意图
Identify three elements from the user's request:
从用户请求中识别三个要素:
- Platform / 平台 — which service (twitter, bilibili, reddit, xiaohongshu, etc.) / 哪个服务
- Action / 动作 — what to do (post, search, like, follow, download, trending, etc.) / 要做什么
- Parameters / 参数 — content, limits, output paths, formats, etc. / 内容、数量限制、输出路径、格式等
Step 2: Map to OpenCLI Command / 第二步:映射为 OpenCLI 命令
Construct the command using the format:
使用以下格式构造命令:
opencli <platform> <action> [arguments] [--options]
Refer to {SKILL_DIR}/references/command_reference.md for the full command catalog. If unsure about available commands for a platform, run:
参考 {SKILL_DIR}/references/command_reference.md 获取完整命令目录。如果不确定某个平台支持的命令,运行:
opencli <platform> --help
Or list all available commands / 或列出所有可用命令:
opencli list
Step 3: Execute and Report / 第三步:执行并反馈
Execute the command via terminal, then:
通过终端执行命令,然后:
- Parse the output and present results to the user in a readable format / 解析输出,以易读格式呈现结果
- If the command fails, check error messages and suggest fixes (e.g., "Please log into Twitter in Chrome first") / 如果命令失败,检查错误信息并建议修复方法(例如"请先在 Chrome 中登录 Twitter")
- For data retrieval commands, use
--format json(-f json) for structured output when further processing is needed / 对于数据检索命令,需要进一步处理时使用-f json获取结构化输出
Common Global Options / 通用全局选项
| Option / 选项 | Short / 缩写 | Description / 描述 |
|---|---|---|
--format <type> | -f | Output format / 输出格式: table (default/默认), json, yaml, md, csv |
--limit <n> | Limit number of results / 限制结果数量 | |
-v | Verbose/debug mode / 详细/调试模式 |
Platform Command Quick Reference / 平台命令速查
Social Media — Posting & Interaction / 社交媒体 — 发帖与互动
Twitter/X (推特):
# Post a tweet / 发布推文
opencli twitter post "Hello World"
# Post a reply to a specific tweet / 回复特定推文
opencli twitter reply <tweet_id> "reply content"
# Like a tweet / 点赞推文
opencli twitter like <tweet_id>
# Follow a user / 关注用户
opencli twitter follow <username>
# Unfollow a user / 取消关注
opencli twitter unfollow <username>
# Search tweets / 搜索推文
opencli twitter search "keyword" --limit 10
# Get timeline / 获取时间线
opencli twitter timeline --limit 20
# Get trending topics / 获取热门话题
opencli twitter trending
# Get user profile / 获取用户资料
opencli twitter profile <username>
# Block / Unblock / 拉黑 / 解除拉黑
opencli twitter block <username>
opencli twitter unblock <username>
# Bookmark / 收藏
opencli twitter bookmark <tweet_id>
opencli twitter unbookmark <tweet_id>
# Delete a tweet / 删除推文
opencli twitter delete <tweet_id>
# Download media / 下载媒体
opencli twitter download <tweet_id> --output ./twitter
Reddit:
opencli reddit hot --limit 10 # 获取热门帖子
opencli reddit search "keyword" --limit 10 # 搜索帖子
opencli reddit post <subreddit> "title" "body" # 发帖
opencli reddit comment <post_id> "comment content" # 评论
Facebook (脸书):
opencli facebook feed --limit 10 # 获取动态流
opencli facebook post "content" # 发布动态
Instagram (照片墙):
opencli instagram feed --limit 10 # 获取动态
opencli instagram profile <username> # 查看用户资料
LinkedIn (领英):
opencli linkedin feed --limit 10 # 获取动态
opencli linkedin profile <username> # 查看用户资料
Bluesky:
opencli bluesky feed --limit 10 # 获取动态
opencli bluesky post "content" # 发布帖子
Content Platforms — Chinese / 内容平台 — 中文
Bilibili (B站):
opencli bilibili hot --limit 10 # 获取热门视频
opencli bilibili search "keyword" --limit 10 # 搜索视频
opencli bilibili download <BV_ID> --output ./bilibili # 下载视频(需 yt-dlp)
Xiaohongshu (小红书):
opencli xiaohongshu hot --limit 10 # 获取热门笔记
opencli xiaohongshu search "keyword" --limit 10 # 搜索笔记
opencli xiaohongshu download <note_id> --output ./xhs # 下载笔记(图片/视频)
Zhihu (知乎):
opencli zhihu hot --limit 10 # 获取热门问题
opencli zhihu search "keyword" --limit 10 # 搜索问答
Weibo (微博):
opencli weibo hot --limit 10 # 获取热搜
opencli weibo search "keyword" --limit 10 # 搜索微博
Douyin (抖音):
opencli douyin hot --limit 10 # 获取热门视频
opencli douyin search "keyword" --limit 10 # 搜索视频
News & Tech / 新闻与科技
HackerNews:
opencli hackernews top --limit 10 # 获取热门文章
opencli hackernews new --limit 10 # 获取最新文章
Product Hunt:
opencli producthunt top --limit 10 # 获取热门产品
Desktop App Control (Electron via CDP) / 桌面应用控制
opencli cursor chat "message" # 在 Cursor IDE 中发送消息
opencli chatgpt send "message" # 向 ChatGPT 桌面版发送消息
opencli notion search "keyword" # 在 Notion 中搜索
External CLI Hub / 外部 CLI 集线器
OpenCLI can proxy and auto-install external CLI tools:
OpenCLI 可以代理并自动安装外部 CLI 工具:
# Automatically installs gh if missing, then runs the command
# 如果 gh 未安装,会自动安装后再执行命令
opencli gh pr list --limit 5
opencli docker ps
Error Handling / 错误处理
| Error / 错误 | Cause / 原因 | Solution / 解决方案 |
|---|---|---|
Extension not connected | Chrome extension not loaded or Chrome not running / Chrome 扩展未加载或 Chrome 未运行 | Ensure Chrome is open with the extension enabled / 确保 Chrome 已打开且扩展已启用 |
Unauthorized / empty data | Not logged into the target website / 未登录目标网站 | Log into the website in Chrome / 在 Chrome 中登录该网站 |
Command not found | opencli not installed or not in PATH / opencli 未安装或不在 PATH 中 | Run npm install -g @jackwener/opencli / 运行安装命令 |
Node version error | Node.js < 20.0.0 / Node.js 版本过低 | Upgrade Node.js to >= 20.0.0 / 升级 Node.js 到 20.0.0 以上 |
Timeout | Page loading too slow or site blocked / 页面加载过慢或站点被屏蔽 | Check network connection; try with -v for debug info / 检查网络连接;使用 -v 查看调试信息 |
Important Notes / 重要说明
- Always ensure the user is logged into the target website in Chrome before executing write operations (post, like, follow, etc.) / 执行写操作(发帖、点赞、关注等)前,始终确保用户已在 Chrome 中登录目标网站
- For read-only operations on public data (e.g.,
hackernews top), no login is required / 对于公开数据的只读操作(如hackernews top),无需登录 - Video download operations may require
yt-dlpto be installed:brew install yt-dlp/ 视频下载可能需要安装 yt-dlp:brew install yt-dlp - Use
-f jsonwhen output needs to be parsed programmatically / 需要程序化处理输出时使用-f json - When the user's request is ambiguous about the platform, ask for clarification / 当用户请求中平台不明确时,请求用户澄清
- For discovering new or undocumented commands, run
opencli listoropencli <platform> --help/ 发现新命令或未文档化命令,运行opencli list或opencli <platform> --help
Files
3 totalComments
Loading comments…
