CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Restish

$ restish 社区开源 中风险
rest-sh · 浏览器与网页抓取 · MIT · macos / linux / windows

Restish(rest-sh/restish)可将任意 OpenAPI 3 / Swagger 接口自动转换为带子命令补全的 CLI,支持自动分页、OAuth2 认证及多种输出格式(-o json、-o yaml、-o ndjson、-o toon 与 -f <filter> 字段过滤),同时面向终端用户与省 Token 的 AI Agent。

FCRS-1.0 综合评分
89 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install restish
CLI vs MCP 选型建议 优先选 CLI

restish 按需自动发现 OpenAPI 端点,并支持 -f 'body...' 字段过滤与 -o toon 紧凑输出,避免在对话前加载庞大的 OpenAPI MCP 工具定义。

Agent 友好度体检单

✓ 原生 JSON 输出
✓ 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 24 / 25

提供 -o json、-o ndjson、-o toon、内联 -f 响应过滤与基于 OpenAPI 的 --help 自发现。

  • Supports -o json, -o toon, and -f <filter> field projection
  • Auto-generates --help docs from OpenAPI schemas
安全与权限边界 20 / 25

通过 Profile 按 API 隔离基地址与认证信息,但远端写操作缺少全局 --dry-run。

  • Scoped per-API profiles in apis.json
  • Supports --rsh-no-browser for headless auth flows
安装与运行摩擦 15 / 15

单一 Go 二进制,支持 brew install restish、go install 与跨平台 GitHub Releases。

  • Static Go binary on macOS, Linux, and Windows
能力覆盖与边际价值 14 / 15

即时将任意 OpenAPI 服务转为功能完备的 CLI,内置分页、认证与紧凑格式化。

  • Instant OpenAPI discovery plus ad-hoc HTTP shorthand
维护与来源背书 8 / 10

活跃的 MIT 开源社区项目(rest-sh/restish)。

  • MIT-licensed rest-sh/restish repository
文档与可验证性 8 / 10

rest.sh 文档详尽覆盖 Profile、过滤语法、-o toon 与 OAuth2。

  • Official docs at rest.sh and self-documenting OpenAPI --help

安全边界、鉴权与放权指南

鉴权方式
无需鉴权 环境变量密钥 浏览器 OAuth 本地配置文件
凭证存储位置

将 API Profile、Bearer 密钥与 OAuth2 令牌保存于 ~/.config/restish/(apis.json),无头环境支持 --rsh-no-browser。

潜在副作用
只读查询 本地写入 远端写入
费用与配额提示

MIT 开源 Go CLI,完全免费。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# 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 高频安全命令配方

只读查询(安全推荐)

以 JSON 与字段过滤查询 REST 端点
restish api.rest.sh/images -o json -f 'body.#.name'

以 JSON 格式拉取接口并通过 -f 内联筛选字段以节省 Token。

在已注册 API 上使用紧凑 TOON 输出
restish myapi list-items -o toon

调用 OpenAPI 自动发现的操作并输出省 Token 的 -o toon 格式。

受控写入与预演

使用简写语法发送 JSON POST 请求
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 授权码流程仍需浏览器或手动粘贴授权码(客户端凭据模式除外)。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI