跳转到内容
AggregaAggrega
选择语言: 简体中文
本页面由机器翻译。阅读英文原文。

aggrega get-schema

打印实体或契约种类的 JSON Schema

概要

aggrega get-schema [kind] [flags]

说明

Print the canonical JSON Schema for an embedded kind.
The kind is the lowercase-hyphenated schema name — for example component, aggregate, ir, or template-context. Entity kinds, the intermediate-representation and wire-format contracts, and the wasm-* plugin socket contracts are all addressable. The emitted bytes are identical to the distributed schema file.
Use --list to enumerate every available kind, one per line.

标志

标志默认值描述
--listfalse列出所有 schema 种类,每行一个。

功能说明

aggrega get-schema <kind> 将某个实体或契约种类的规范 JSON Schema 打印到标准输出。该 schema 是权威的结构契约:编译器对该种类接受的必填字段、允许的值以及嵌套结构。它来自内置于二进制文件中的 schema,因此输出始终与你正在运行的 aggrega 版本一致。

aggrega get-schema --list 打印你可以请求的每个种类的名称,每行一个——包括作者编写的实体种类(aggregate、component、feature、recipe、featurerecipe、manifest、release、plugin、schemalibrary、mappinglibrary、workloadlibrary、artifactlibrary、workload)以及编译器使用的内部契约 schema。不确定要传入的确切标记时,请先运行它。

使用场景

在编写过程中需要了解某个种类的确切结构时——哪些字段是必填的、值可以是什么、块如何嵌套——请使用 get-schema。它是检查手写文件的基准依据,也是学习不熟悉的种类时的起点。由于它打印的是机器可读的 JSON Schema,你还可以将其提供给支持 schema 的编辑器或验证工具。

通过 aggrega mcp 连接的 AI 助手从 schema://<kind> 资源读取相同的字节,因此助手编写时所依据的 schema 与你在命令行获取的 schema 完全相同。本页记录该命令,不复述任何 schema 的内容——请运行该命令,或打开对应的实体参考页面,查看逐字段说明各字段的含义。

示例

打印 Component 的 schema:

Terminal window
aggrega get-schema component

列出可以请求的所有种类:

Terminal window
aggrega get-schema --list

获取 schema 并用 JSON 工具查看单个字段:

Terminal window
aggrega get-schema recipe | jq '.properties.spec'

关于此命令所服务的编写循环——了解结构、生成脚手架、填充、验证——请参阅编写 Aggrega 文件。