Restish
$ restish 社区开源 中风险Restish(rest-sh/restish)可将任意 OpenAPI 3 / Swagger 接口自动转换为带子命令补全的 CLI,支持自动分页、OAuth2 认证及多种输出格式(-o json、-o yaml、-o ndjson、-o toon 与 -f <filter> 字段过滤),同时面向终端用户与省 Token 的 AI Agent。
brew install restish restish 按需自动发现 OpenAPI 端点,并支持 -f 'body...' 字段过滤与 -o toon 紧凑输出,避免在对话前加载庞大的 OpenAPI MCP 工具定义。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
提供 -o json、-o ndjson、-o toon、内联 -f 响应过滤与基于 OpenAPI 的 --help 自发现。
- Supports
-o json,-o toon, and-f <filter>field projection - Auto-generates
--helpdocs from OpenAPI schemas
通过 Profile 按 API 隔离基地址与认证信息,但远端写操作缺少全局 --dry-run。
- Scoped per-API profiles in
apis.json - Supports
--rsh-no-browserfor headless auth flows
单一 Go 二进制,支持 brew install restish、go install 与跨平台 GitHub Releases。
- Static Go binary on macOS, Linux, and Windows
即时将任意 OpenAPI 服务转为功能完备的 CLI,内置分页、认证与紧凑格式化。
- Instant OpenAPI discovery plus ad-hoc HTTP shorthand
活跃的 MIT 开源社区项目(rest-sh/restish)。
- MIT-licensed
rest-sh/restishrepository
rest.sh 文档详尽覆盖 Profile、过滤语法、-o toon 与 OAuth2。
- Official docs at rest.sh and self-documenting OpenAPI
--help
安全边界、鉴权与放权指南
将 API Profile、Bearer 密钥与 OAuth2 令牌保存于 ~/.config/restish/(apis.json),无头环境支持 --rsh-no-browser。
MIT 开源 Go CLI,完全免费。
# Restish (restish) Agent Rules - Always pass `-o json` or `-o toon` with `-f <filter>` to keep response payloads concise. - Run `restish <api> --help` to verify OpenAPI-discovered operation names and HTTP methods before calling write operations. - Pass `--rsh-no-browser` if running in a headless environment.
Agent 高频安全命令配方
只读查询(安全推荐)
restish api.rest.sh/images -o json -f 'body.#.name'
以 JSON 格式拉取接口并通过 -f 内联筛选字段以节省 Token。
restish myapi list-items -o toon
调用 OpenAPI 自动发现的操作并输出省 Token 的 -o toon 格式。
受控写入与预演
restish myapi create-item name:demo,enabled:true -o json
以简写键值对语法向 OpenAPI 端点提交创建请求并返回 JSON。
核心优势
- + 支持
-o json、-o toon与内联-f过滤,显著减少 Agent 上下文开销。 - + OpenAPI 自动发现将任意 REST 接口转化为可自省的子命令树。
注意事项与踩坑点
- ! 执行变更类
POST/PUT/DELETE操作前缺少全局--dry-run。 - ! OAuth2 授权码流程仍需浏览器或手动粘贴授权码(客户端凭据模式除外)。