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

AsyncAPI CLI

$ asyncapi 基金会 低风险
AsyncAPI · 设计与文档排版 · Apache-2.0 · macos / linux / windows

AsyncAPI 官方 CLI 用于校验、打包、比对、转换 AsyncAPI 2.x/3.x 事件驱动规范并生成代码或文档。Agent 可使用 asyncapi validate --diagnostics-format json 获取结构化检查结果,并用 asyncapi bundle -o 解析外部 $ref 引用。

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

直接在本地运行 asyncapi validate --diagnostics-format json 与 asyncapi bundle 处理仓库规范,无需通过 MCP 上传 Schema。

Agent 友好度体检单

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

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

FCRS-1.0 六维评分拆解

Agent 友好度 20 / 25

validate --diagnostics-format json 可输出干净的 JSON 诊断且 bundle 支持无头运行,但需避开 asyncapi new 等交互子命令和会阻塞的 start studio。

  • --diagnostics-format json supported on asyncapi validate
  • asyncapi start studio launches a blocking local server
安全与权限边界 22 / 25

validate 为只读;bundle 与 generate 仅写入显式指定的 --output 路径。

  • Clear separation between validate and write commands
安装与运行摩擦 14 / 15

可通过 Homebrew、npm 与 npx @asyncapi/cli 在 macOS、Linux 与 Windows 安装。

  • Distributed on both Homebrew and npm
能力覆盖与边际价值 13 / 15

集 AsyncAPI 2.x/3.x 校验、版本转换、打包与模板生成于一体的官方工具链。

  • Covers validation, bundling, diffing, and code/doc generation
维护与来源背书 9 / 10

由 AsyncAPI Initiative / Linux Foundation(asyncapi/cli)维护的 Apache-2.0 官方项目。

  • Official Linux Foundation / AsyncAPI organization
文档与可验证性 8 / 10

asyncapi.com/docs/tools/cli 提供完整的 CLI 文档及清晰的 --help 输出。

  • Official docs at asyncapi.com/docs/tools/cli

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

鉴权方式
无需鉴权
凭证存储位置

无需凭据;仅读取本地或公开 URL 的 AsyncAPI 规范文件。

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

100% 免费且遵循 Apache-2.0 开源协议。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# AsyncAPI CLI Agent Rules
- Always pass `--diagnostics-format json` when running `asyncapi validate`.
- Never run `asyncapi start studio` in a non-interactive agent turn (starts a blocking web UI server).
- Pass `--output <file>` explicitly to `asyncapi bundle` and `asyncapi generate`.

Agent 高频安全命令配方

只读查询(安全推荐)

校验 AsyncAPI 规范并输出 JSON 诊断
asyncapi validate asyncapi.yaml --diagnostics-format json

对 AsyncAPI 文档执行只读校验,并输出基于 Spectral 的 JSON 诊断结果。

受控写入与预演

将多文件 AsyncAPI 引用打包为单文件
asyncapi bundle asyncapi.yaml --output dist/asyncapi.bundled.yaml

解析外部 $ref 引用并将自包含的 AsyncAPI 规范写入 dist/asyncapi.bundled.yaml。

核心优势

  • + asyncapi validate --diagnostics-format json 返回结构化校验错误。
  • + Linux Foundation 官方工具,完整支持 AsyncAPI 2.x 与 3.x 规范。
  • + 支持 Homebrew(brew install asyncapi)或 npx @asyncapi/cli 便捷安装。

注意事项与踩坑点

  • ! 执行 asyncapi start studio 会启动持久化本地 Studio UI 服务并阻塞终端。
  • ! asyncapi new 等命令在缺少模板或文件参数时会触发交互提示。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI