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

Smithy CLI

$ smithy 官方出品 低风险
AWS · 设计与文档排版 · Apache-2.0 · macos / linux / windows

AWS 官方 Smithy CLI 用于校验 .smithy 接口定义模型、导出 JSON 语义语法树(smithy ast),并通过 smithy build 生成 OpenAPI 规范、客户端/服务端代码与文档。支持 --no-color、--logging 及确定性的 CI 退出码。

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

Smithy 模型校验、AST 导出(smithy ast)及 OpenAPI 投影均直接在本地 .smithy 工作区运行 smithy,无需 MCP。

Agent 友好度体检单

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

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

FCRS-1.0 六维评分拆解

Agent 友好度 21 / 25

smithy ast 可在标准输出打印干净的 JSON AST,--no-color 与 --logging 可控输出,且 smithy validate 非交互运行并返回严格退出码。

  • smithy ast outputs full semantic JSON AST
  • Supports --no-color, --logging <LEVEL>, and headless validate
安全与权限边界 22 / 25

validate 与 ast 严格只读;build 仅将投影产物写入 build/smithy(或 --output)。

  • Read-only validate and ast subcommands
安装与运行摩擦 12 / 15

通过 Homebrew tap(smithy-lang/tap/smithy-cli)或官方归档安装,依赖与 JVM/Gradle 生态较 Go/Rust 单二进制更重。

  • Requires smithy-lang/tap on Homebrew and JVM-backed dependency resolution
能力覆盖与边际价值 13 / 15

AWS 风格服务模型的一等 IDL 编译器,可由单一信源生成 OpenAPI、多语言 SDK 与文档。

  • Single-source IDL projecting OpenAPI and multi-language SDKs
维护与来源背书 10 / 10

由 AWS 官方仓库(smithy-lang/smithy)积极维护的 Apache-2.0 项目。

  • Official AWS Smithy organization
文档与可验证性 9 / 10

smithy.io 提供完备的 Smithy 2.0 官方 CLI 指南。

  • Official CLI guides at smithy.io/2.0/guides/smithy-cli/

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

鉴权方式
无需鉴权 本地配置文件
凭证存储位置

本地模型无需凭据;若需拉取私有 Maven 模型依赖,凭据保存在本地配置中。

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

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

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Smithy CLI Agent Rules
- Run `smithy validate --no-color` before `smithy build` to catch model errors without writing artifacts.
- Use `smithy ast` when inspecting resolved shapes programmatically in JSON.
- Pass `--no-color` and `--logging WARNING` when compact output is needed.

Agent 高频安全命令配方

只读查询(安全推荐)

校验 Smithy 模型而不生成构建产物
smithy validate --no-color

以只读方式解析并校验 smithy-build.json 与 .smithy 文件,不写入输出文件。

将解析后的 Smithy 语义 AST 导出为 JSON
smithy ast model/

将校验通过的 Smithy 模型序列化为机器可读的 JSON AST 输出至标准输出。

受控写入与预演

将 Smithy 投影产物构建至 build/smithy
smithy build --no-color

根据配置将 OpenAPI Schema、SDK 或其他产物输出至 build/smithy。

核心优势

  • + AWS 官方 IDL 工具链,提供严格的 validate 与 smithy ast JSON 导出。
  • + 支持 --no-color 与 --logging 控制,适配 CI 与 Agent 沙箱。
  • + 可从 .smithy 模型确定性投影生成 OpenAPI 规范与 SDK。

注意事项与踩坑点

  • ! Homebrew 安装需先 tap smithy-lang/tap/smithy-cli 或使用平台归档包。
  • ! 冷缓存下解析外部 Maven/JAR 模型依赖时需要网络访问。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI