Smithy CLI
$ smithy 官方出品 低风险AWS 官方 Smithy CLI 用于校验 .smithy 接口定义模型、导出 JSON 语义语法树(smithy ast),并通过 smithy build 生成 OpenAPI 规范、客户端/服务端代码与文档。支持 --no-color、--logging 及确定性的 CI 退出码。
brew install smithy-lang/tap/smithy-cli Smithy 模型校验、AST 导出(smithy ast)及 OpenAPI 投影均直接在本地 .smithy 工作区运行 smithy,无需 MCP。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
smithy ast 可在标准输出打印干净的 JSON AST,--no-color 与 --logging 可控输出,且 smithy validate 非交互运行并返回严格退出码。
smithy astoutputs full semantic JSON AST- Supports
--no-color,--logging <LEVEL>, and headlessvalidate
validate 与 ast 严格只读;build 仅将投影产物写入 build/smithy(或 --output)。
- Read-only
validateandastsubcommands
通过 Homebrew tap(smithy-lang/tap/smithy-cli)或官方归档安装,依赖与 JVM/Gradle 生态较 Go/Rust 单二进制更重。
- Requires
smithy-lang/tapon Homebrew and JVM-backed dependency resolution
AWS 风格服务模型的一等 IDL 编译器,可由单一信源生成 OpenAPI、多语言 SDK 与文档。
- Single-source IDL projecting OpenAPI and multi-language SDKs
由 AWS 官方仓库(smithy-lang/smithy)积极维护的 Apache-2.0 项目。
- Official AWS Smithy organization
smithy.io 提供完备的 Smithy 2.0 官方 CLI 指南。
- Official CLI guides at smithy.io/2.0/guides/smithy-cli/
安全边界、鉴权与放权指南
本地模型无需凭据;若需拉取私有 Maven 模型依赖,凭据保存在本地配置中。
100% 免费且遵循 Apache-2.0 开源协议。
# 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 validate --no-color
以只读方式解析并校验 smithy-build.json 与 .smithy 文件,不写入输出文件。
smithy ast model/
将校验通过的 Smithy 模型序列化为机器可读的 JSON AST 输出至标准输出。
受控写入与预演
smithy build --no-color
根据配置将 OpenAPI Schema、SDK 或其他产物输出至 build/smithy。
核心优势
- + AWS 官方 IDL 工具链,提供严格的
validate与smithy astJSON 导出。 - + 支持
--no-color与--logging控制,适配 CI 与 Agent 沙箱。 - + 可从
.smithy模型确定性投影生成 OpenAPI 规范与 SDK。
注意事项与踩坑点
- ! Homebrew 安装需先 tap
smithy-lang/tap/smithy-cli或使用平台归档包。 - ! 冷缓存下解析外部 Maven/JAR 模型依赖时需要网络访问。