CUE
$ cue 官方出品 低风险CUE 约束配置语言的官方命令行工具,集 Schema 校验、JSON/YAML/OpenAPI 生成与策略检查于一体。为 Agent 提供确定性的 cue vet 校验、cue export --out json 编译输出以及 cue fmt --check 格式预检。
brew install cue 毫秒级在本地完成 CUE Schema 校验与 JSON/YAML 编译求值,无需 MCP。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
支持 --out json / jsonl / yaml、-e <expr> 字段提取、cue fmt --check 以及完备的 cue help 子命令体系。
cue export --out json -e <expr>supports native JSON output and expression filteringcue fmt --checksupports non-destructive verification
封闭求值模型不执行任意代码;vet、eval 与 export 默认严格只读(除非指定 --outfile)。
- Purely declarative hermetic evaluation with zero side effects
静态 Go 单二进制,可通过 Homebrew、go install、Docker 与 GitHub Releases 获取。
- Cross-platform single Go executable
将校验(vet)、转换(export)与 Schema 导入(import OpenAPI/JSON Schema)统一在单个 CLI 中。
- Replaces separate schema validator and templating tools
CUE 官方项目(cue-lang/cue),采用 Apache-2.0 协议持续活跃演进。
- Official
cue-lang/cuerepository
cuelang.org 与内置 cue help <topic> 提供了详尽的命令参考。
- Official CLI reference and embedded
cue helptopics
安全边界、鉴权与放权指南
本地 vet/eval/export 无需认证;仅在使用 CUE Central Registry 时通过 cue login 或 CUE_TOKEN 保存凭证。
Apache-2.0 开源 Go 二进制工具,完全免费。
# CUE (cue) Agent Rules - Always pass `-c` (concrete) to `cue vet` when validating production data so incomplete fields do not pass silently. - Use `cue export --out json -e <field>` to extract only the evaluated JSON subtree needed.
Agent 高频安全命令配方
只读查询(安全推荐)
cue vet -c schema.cue data.yaml
通过 -c 要求具体值,依据 CUE 约束校验 data.yaml 且不修改任何文件。
cue export --out json -e config app.cue
求值并提取 config 字段,以合法 JSON 格式输出到 stdout。
受控写入与预演
cue fmt --check . && cue fmt .
先检查再确定性格式化 .cue 源文件。
核心优势
- + 封闭式约束求值在校验复杂配置时杜绝任意脚本执行风险。
- + 原生
cue export --out json -e <expr>同时兼顾 JSON 序列化与字段裁剪。
注意事项与踩坑点
- ! 执行
cue vet若漏传-c,未实例化完成的抽象字段可能静默通过校验。 - ! 深层约束合一失败时的报错信息有时较为冗长。