Install
openclaw skills install opencli-rs基于Rust的通用命令行枢纽 - 将任何网站、桌面应用、本地CLI工具转变为命令行接口,专为AI Agent和自动化工作流设计。支持55+网站、Electron应用控制和外部CLI集成,单二进制文件4.7MB,性能提升12倍。
openclaw skills install opencli-rsOpenCLI-RS 是基于 Rust 重写的通用 CLI 枢纽工具,能够将任何网站、本地工具、Electron 应用转变为命令行接口,专为 AI Agent 和自动化工作流设计。
核心优势:
GitHub仓库: https://github.com/nashsu/opencli-rs
当以下情况时使用此技能:
# 使用官方安装脚本
curl -fsSL https://raw.githubusercontent.com/nashsu/opencli-rs/main/scripts/install.sh | sh
# 1. 下载对应平台的二进制文件
# Linux x86_64
wget https://github.com/nashsu/opencli-rs/releases/latest/download/opencli-rs-x86_64-unknown-linux-musl.tar.gz
tar -xzf opencli-rs-x86_64-unknown-linux-musl.tar.gz
sudo mv opencli-rs /usr/local/bin/
# 2. 验证安装
opencli-rs --version
# 需要 Rust 工具链
git clone https://github.com/nashsu/opencli-rs.git
cd opencli-rs
cargo build --release
sudo cp target/release/opencli-rs /usr/local/bin/
opencli-rs-chrome-extension.zipchrome://extensions注意: 公开API命令(如 hackernews、devto)无需扩展即可工作。
# 查看所有可用命令
opencli-rs --help
# 查看特定网站的命令帮助
opencli-rs hackernews --help
opencli-rs bilibili --help
# 获取Hacker News热门故事(无需浏览器)
opencli-rs hackernews top --limit 10
# JSON格式输出
opencli-rs hackernews top --limit 5 --format json
# 获取B站热门视频(需要浏览器+Cookie)
opencli-rs bilibili hot --limit 20
# 搜索Twitter(需要浏览器+登录)
opencli-rs twitter search "rust lang" --limit 10
# 运行诊断
opencli-rs doctor
# 生成Shell自动补全
opencli-rs completion bash >> ~/.bashrc
opencli-rs completion zsh >> ~/.zshrc
opencli-rs completion fish > ~/.config/fish/completions/opencli-rs.fish
# 控制Cursor编辑器
opencli-rs cursor status
opencli-rs cursor send "分析这段代码"
# 控制Codex编辑器
opencli-rs codex status
opencli-rs codex send "实现排序算法"
# 控制ChatGPT桌面版
opencli-rs chatgpt status
opencli-rs chatgpt send "解释量子计算"
# 控制Notion
opencli-rs notion search "项目文档"
# 控制Discord
opencli-rs discord-app channels
# GitHub CLI
opencli-rs gh repo list
opencli-rs gh pr list --limit 5
# Docker CLI
opencli-rs docker ps
opencli-rs docker images
# Kubernetes CLI
opencli-rs kubectl get pods
opencli-rs kubectl get nodes
# 其他工具
opencli-rs obsidian search "笔记"
opencli-rs readwise highlights
# ASCII表格(默认)
opencli-rs hackernews top --format table
# JSON格式
opencli-rs hackernews top --format json
# YAML格式
opencli-rs hackernews top --format yaml
# CSV格式
opencli-rs hackernews top --format csv
# Markdown表格
opencli-rs hackernews top --format md
# AI可以自动发现所有可用工具
opencli-rs --help | grep -A5 "Available commands"
# 配置在AGENT.md中
echo "tools: opencli-rs list" >> AGENT.md
# 注册自定义CLI工具
opencli-rs register mycli --path /usr/local/bin/mycli
# AI可以无缝调用注册的工具
opencli-rs mycli --help
# 探索网站API
opencli-rs explore https://example.com
# 自动检测认证策略
opencli-rs cascade https://api.example.com/data
# 一键生成适配器
opencli-rs generate https://example.com --goal "hot posts"
在 ~/.opencli-rs/adapters/ 创建自定义适配器:
# ~/.opencli-rs/adapters/mysite/hot.yaml
site: mysite
name: hot
description: My site hot posts
strategy: public
browser: false
args:
limit:
type: int
default: 20
description: Number of items
columns: [rank, title, score]
pipeline:
- fetch: https://api.mysite.com/hot
- select: data.posts
- map:
rank: "${{ index + 1 }}"
title: "${{ item.title }}"
score: "${{ item.score }}"
- limit: "${{ args.limit }}"
# 变量访问
"${{ args.limit }}"
"${{ item.title }}"
# 条件表达式
"${{ item.score > 10 }}"
"${{ item.active ? 'yes' : 'no' }}"
# 管道过滤器
"${{ item.title | truncate(30) }}"
"${{ item.tags | join(', ') }}"
# 字符串插值
"https://api.com/${{ item.id }}.json"
# 启用详细输出
export OPENCLI_VERBOSE=1
# 更改守护进程端口
export OPENCLI_DAEMON_PORT=19826
# 命令超时设置
export OPENCLI_BROWSER_COMMAND_TIMEOUT=120
~/.opencli-rs/
├── adapters/ # 自定义适配器
├── plugins/ # 用户插件
└── external-clis.yaml # 外部CLI注册表
编辑 ~/.opencli-rs/external-clis.yaml:
- name: mytool
description: My custom tool
executable: /usr/local/bin/mytool
arguments: []
environment: {}
| 指标 | opencli-rs (Rust) | opencli (Node.js) | 改进 |
|---|---|---|---|
| 内存使用(公开命令) | 15 MB | 99 MB | 6.6x |
| 内存使用(浏览器命令) | 9 MB | 95 MB | 10.6x |
| 二进制大小 | 4.7 MB | ~50 MB (node_modules) | 10x |
| 运行时依赖 | 无 | Node.js 20+ | 零依赖 |
| 真实命令执行时间 | 1.66s (B站热门) | 20.1s | 🔥 12x |
# 检查守护进程状态
opencli-rs doctor
# 重启守护进程
pkill -f opencli-rs
opencli-rs doctor
# 增加超时时间
export OPENCLI_BROWSER_COMMAND_TIMEOUT=120
opencli-rs bilibili hot
# 确保Chrome正在运行
# 或使用指定的浏览器路径
export OPENCLI_BROWSER_PATH=/usr/bin/google-chrome
# 运行完整诊断
opencli-rs doctor
# 查看详细日志
export OPENCLI_VERBOSE=1
opencli-rs bilibili hot --limit 1
# 检查网络连接
curl -I https://github.com/nashsu/opencli-rs
# 重新运行安装脚本
curl -fsSL https://raw.githubusercontent.com/nashsu/opencli-rs/main/scripts/install.sh | sh
# 或手动下载最新版本
wget https://github.com/nashsu/opencli-rs/releases/latest/download/opencli-rs-x86_64-unknown-linux-musl.tar.gz
tar -xzf opencli-rs-x86_64-unknown-linux-musl.tar.gz
sudo mv opencli-rs /usr/local/bin/
# 删除二进制文件
sudo rm /usr/local/bin/opencli-rs
# 删除用户配置
rm -rf ~/.opencli-rs/
# 删除Chrome扩展
# 在 chrome://extensions 中移除扩展
# 在技能脚本中调用opencli-rs
#!/bin/bash
# fetch_news.sh - 获取新闻并输出为JSON
opencli-rs hackernews top --limit 20 --format json > news.json
# 每小时获取B站热门视频
0 * * * * opencli-rs bilibili hot --limit 10 --format json > /tmp/bilibili_hot_$(date +\%Y\%m\%d-\%H).json
# 在AGENT.md中配置
tools:
- name: opencli-rs
description: Universal CLI hub for web, desktop, and local tools
examples:
- "Get trending news: opencli-rs hackernews top --limit 10"
- "Search Twitter: opencli-rs twitter search 'AI news' --limit 5"
- "Control Cursor: opencli-rs cursor send 'Analyze this code'"
Apache 2.0
🚀 现在您可以使用高性能的 opencli-rs 来控制55+网站、桌面应用和本地CLI工具了!