aggrega plugin
檢視 CLI 能解析的 Wasm 外掛程式
概要
aggrega plugin說明
Work with the WebAssembly plugins this CLI can resolve.
All of Aggrega's provider-specific and policy-specific behaviour lives in Wasmplugins rather than in the binary, so this is where you see which ones arereachable, add or remove a workspace binding, and check a guest before youpublish it.
Plugins reach the CLI two ways. Some are compiled into the binary and resolvewith no filesystem, cache or network access. The rest are workspace bindings in.aggrega-config.yaml, resolved through the plugin cascade. "aggrega plugin list"shows both groups together.
The subcommands below cover the whole life of a binding: list what is reachable,add and remove bindings, run a local guest export directly, sync themachine-owned records in a Plugin entity with its .wasm, and generate Plugincatalog entities from a guest's own metadata.子命令
| 命令 | 說明 |
|---|---|
aggrega plugin add | 在登錄庫中尋找指定型別的外掛程式並加入它 |
aggrega plugin gen-catalog | 從客體的 describe() 加上撰寫的覆蓋層產生 Plugin 目錄實體 |
aggrega plugin list | 列出 CLI 能解析的外掛程式及其 describe() 中繼資料 |
aggrega plugin remove | 移除指定型別的已設定外掛程式 |
aggrega plugin run-local | 載入本機 .wasm 客體並呼叫它的其中一個匯出 |
aggrega plugin sync | 將外掛程式實體檔案中由機器擁有的記錄(主機函式、CLI 命令)與其 .wasm 同步 |
aggrega plugin add 說明
Find a plugin of the named type in the configured registry and add it to yourconfiguration.
Examples: aggrega plugin add cli moo # add the moo command aggrega plugin add cli moo:0.2.4 # a specific version aggrega plugin add governance rego --role render-verdict
Arguments: <type> The plugin socket to add for. One of: provider, governance, linter, importer, or cli. The governance type requires --role. <query> The plugin's name, optionally followed by :<version> to add that version rather than the latest published one. The name is looked up directly first. Where no plugin of the chosen type has that name, it is matched as a case-insensitive substring against the plugin names of that type, which reads the registry's whole catalog and must resolve to exactly one plugin — otherwise the command lists the candidates so you can narrow it. A query naming a version is never matched that way. The provider type takes no version.
What add writes depends on the type:
- A socket type (governance, linter, importer) pins the version the query names, or else the latest published version, and adds the bare plugin identity (<type>/<name>:<version>) to the plugins.<type> list. The latest is never taken from pre-release versions, so a plugin that publishes only those is added by naming one. A governance entry also records its --role, one of annotation-transform, label-transform, ir-verdict, or render-verdict. An importer the plugins.importer list already names keeps its one entry, moved to the pinned version with its place and what it carries under with. - The provider type adds a plugins.providers entry naming the plugin by its bare identity (provider/<name>) with no version; --capability names the capability the binding serves, preserving existing settings. The version is the one the Recipe pins, or else the highest available, and the lockfile records the one a pull chose. - The cli type fetches the plugin from the registry, verifies it, and caches its bytes, then pins it into the plugins.cli list as a top-level aggrega command — no separate pull step. Its resolved reference and the content digest of the verified bytes are recorded so the command runs those exact bytes, resolving from the local cache on later runs with no further network access. A cli plugin defaults to the global config, so its command is available in every workspace; --workspace pins it to this project instead. It needs no workspace: run outside one, its bytes are cached in the machine-wide cache rather than in the folder you ran it in. Its declared capabilities are confirmed before installing, and --accept-capabilities or --yes skips that prompt for non-interactive use.
A provider or socket attachment is written to a workspace's own configurationunless --global is passed, so outside a workspace it is refused before theregistry is reached; so is anything else that can be refused without it.
A provider or socket attachment is configuration you go on editing, so --dry-rundoes everything the plain command does except write: it hands back theconfiguration the write would have produced, creating and modifying nothing. Theanswer names the file that content is for — which matters here, because a--global attachment targets the config shared across every workspace. A callerthat keeps its own document model puts the content there, where it is visiblebefore it is saved and can be amended or undone. The registry is still searched,and for a socket type the version still resolved, since the returned documentcarries the identity a write would have written.
Under --dry-run standard output carries that content and nothing else, so it staysparseable; a version substitution is announced on standard error instead. The clitype does not accept --dry-run: what it records is the content digest of the bytesit verified, which is a record the machine maintains rather than content youedit.aggrega plugin add 旗標
| 旗標 | 預設 | 說明 |
|---|---|---|
--accept-capabilities | false | 不經互動式提示,直接接受 cli 外掛程式所宣告的能力(僅限 cli 型別) |
--capability | — | 提供者繫結所服務的能力(提供者型別必須提供,且僅對提供者型別有效) |
--dry-run | false | 除了寫入之外全部照做:將產生的設定以內容交回,並指出它所屬的檔案,不建立或修改任何東西。沒有此旗標時,附加項目會寫入解析出的設定檔。cli 型別不接受此旗標。 |
--global | false | 將附加項目寫入所有工作區共用的全域設定。 |
--role | — | 治理附加角色:annotation-transform、label-transform、ir-verdict 或 render-verdict(治理型別必須提供,且僅對治理型別有效) |
--workspace | false | 將附加項目寫入此專案的工作區設定。提供者或插槽附加項目預設寫在此處;cli 外掛程式預設寫入全域設定。 |
--yes | false | 略過 cli 能力確認提示,供非互動式使用(僅限 cli 型別) |
aggrega plugin gen-catalog 說明
Generate one Plugin entity per selected Wasm guest.
Each entity's contract fields — pluginType, abiVersion, capabilities, exports,and contract — are derived from the guest's describe() self-report, so theentity can never promise a capability the binary does not provide. The entity'sidentity (metadata.name), runtime limits, and provider block come from an authoredper-plugin overlay; the entity version is the guest's describe() self-reportversion. The plugin-level description, when the guest reports one, is emitted asmetadata.description and omitted cleanly when it does not.
Two selection modes:
--from-embedded generate an entity for every guest embedded in this binary. The overlay path is a directory; each overlay is matched to a guest by its metadata.name identity, and, where overlays in several socket directories (<socket>/<name>.yaml) declare one name, by the directory naming the guest's socket. --plugin <f.wasm> generate a single entity for one non-embedded guest. The overlay path is a single overlay file.
The output is written under <output-dir>/<pluginType>/<name>/<version>/plugin.yamland carries a generated-output banner. The leading pluginType segment keeps twosame-named plugins in different sockets apart, since a bare plugin name is uniqueonly within its own socket. Regenerating over unchanged inputs yieldsbyte-identical files.
A generated entity is a catalog document you own and go on editing, so --dry-rundoes everything gen-catalog does except write: it hands the content back, creatingand modifying nothing, and the answer names the file each document is for. Acaller that keeps its own document model — an editor, for instance — puts thecontent there, where it is visible before it is saved and can be amended orundone. Every other behaviour is the write's — the same guests are read and thesame overlays matched — so a selection gen-catalog would refuse is refused under--dry-run too. Without the flag the entities are written, because a caller at aterminal has nowhere better to put them.aggrega plugin gen-catalog 旗標
| 旗標 | 預設 | 說明 |
|---|---|---|
--dry-run | false | 除了寫入之外全部照做:將產生的實體以內容交回,並指出每一個所屬的檔案,不建立或修改任何東西。其他所有行為都與寫入相同,因此寫入會拒絕的選取,在這裡同樣會被拒絕。沒有此旗標時,實體會寫在 —output-dir 之下。 |
--from-embedded | false | 為嵌入此二進位檔的每個客體產生一個實體 |
--output-dir | — | 寫入所產生實體的目錄(必填) |
--overlay | — | 撰寫的覆蓋層目錄(—from-embedded)或檔案(—plugin)(必填) |
--plugin | — | 為位於此路徑的 .wasm 客體產生單一實體 |
aggrega plugin list 說明
List every Wasm plugin the CLI can see and, for each, its self-reporteddescribe() metadata.
Two groups are printed. Embedded built-ins are the provider and linter guestscompiled into the binary; they resolve with no filesystem, cache, or networkaccess. Configured plugins are the workspace bindings — the provider and linterbindings and the CLI-extension commands — resolved through the plugin cascade.Each plugin's type appears in the TYPE column, so a CLI-extension command(type cli) is legible alongside the socket plugins; a CLI plugin also carries astatus of its own — ready, unresolved, describe-failed, or digest-drift whenits bytes changed since it was pinned at install.
The default output is a scannable table with one row per plugin, showing itstype, name, served capabilities, and version. The output is read-only anddeterministic. A plugin that fails to resolve or describe is listed with itsfailure status rather than halting the whole listing.
With -o json, the output is a structured object carrying the full per-plugindetail — type, name, version, commit, capabilities, input kinds, boundaryassembly, exports, origin, readiness, and any resolve or describe error —grouped as embedded and configured. It is suitable for programmaticconsumption and documentation generation.aggrega plugin list 旗標
| 旗標 | 預設 | 說明 |
|---|---|---|
--output, -o | table | 輸出格式:table|json。 |
aggrega plugin remove 說明
Remove a configured plugin of the named type from a config file so it no longerparticipates.
The type is one of provider, governance, linter, importer, or cli — the sameset 'plugin add' accepts. The query identifies the entry to remove: the plugin'sshort name (matched against 'add's short name so remove is symmetric with add),its full pinned reference, or, for the provider type, the capability the bindingserves. A query that matches nothing halts and leaves the config untouched, so atypo never silently removes the wrong plugin.
A provider or socket attachment defaults to this project's workspace config; a clicommand defaults to the global config shared across every workspace. --global and--workspace force the file the removal targets, overriding the default.aggrega plugin remove 旗標
| 旗標 | 預設 | 說明 |
|---|---|---|
--global | false | 從所有工作區共用的全域設定中移除。 |
--workspace | false | 從此專案的工作區設定中移除。提供者或插槽附加項目預設在此處;cli 命令預設在全域設定。 |
aggrega plugin run-local 說明
Load a .wasm guest from a filesystem path, call one of its declaredexports with an optional payload, and write the guest's answer to stdout.
The guest is addressed directly by --plugin path; it is not resolved throughthe workspace plugin cascade. The export named by --export must be one theguest advertises in its describe() self-report, or the call is rejected beforethe guest runs.
The command has two forms. The artifact form takes no positional argument andloads the guest bare. The entity form takes a Plugin entity file as its onepositional argument: the entity is schema-validated, and its declaredmetadata.pluginType and export contract are cross-checked against the guest'sdescribe() before the guest runs. In both forms the guest bytes come from--plugin; the entity carries no artifact path.
The payload is supplied with --with, and it is always written as JSON. A valuebeginning with @ reads the payload bytes from a file (--with @input.json); anyother value is taken as a literal inline JSON payload (--with '{"k":1}'). When--with is omitted, the export receives the minimal empty JSON object {}. Theresolved payload is validated as JSON before the guest runs, so malformed inputis reported up front.
An export a socket calls with a payload reads it in a binary encoding ratherthan as JSON; a CLI plugin's cli_run export is the exception, and reads JSON.Which encoding an export reads is fixed by the socket that export serves, so noflag selects it: the resolved payload is converted into the encoding the namedexport reads before the guest is called. The conversion reads the payload'sshape from the export's name, so it covers each export a socket calls bydefault; an entry function an attachment or a pipeline step names under a nameof its own receives the payload as written. The authored payload stays JSONeither way.
The answer is converted the same way in reverse. An export a socket callsanswers in that binary encoding, so its answer is read as the export's outputshape and written to stdout as indented JSON; an answer that is not that shapeis reported as an error naming the export rather than printed. A cli_runexport's answer, and an entry function under a name of its own, are written tostdout exactly as the guest wrote them. When the guest exits non-zero, what itwrote is passed through unchanged.
In the artifact form, --type optionally names a plugin type the guest'sdescribe() self-report must agree with, or the load is rejected before theguest runs; when omitted, no type expectation is imposed. In the entity form--type is rejected, because the entity's metadata.pluginType supplies the type.
The guest's clean exit code becomes this command's exit status, so a failureinside the plugin is distinguishable from a failure of aggrega itself.aggrega plugin run-local 旗標
| 旗標 | 預設 | 說明 |
|---|---|---|
--export | — | 要呼叫的已宣告匯出 |
--plugin | — | .wasm 成品的檔案系統路徑 |
--type | — | 客體的 describe() 自我回報必須相符的外掛程式型別 |
--with | — | 匯出的酬載:內嵌 JSON,或以 @ |
aggrega plugin sync 說明
Sync a plugin's machine-owned records in a Plugin entity file with its .wasm.
Two records are not authored by hand: the set of host functions a plugin maycall, derived from the plugin's .wasm import section, and the top-level commands aCLI plugin contributes, read from the plugin's describe() self-report. Both areground truth in the binary. This command reads the .wasm, derives thehost-function set in canonical form and the command mirror in describe()-declaredorder, and aligns the entity's spec.runtime.hostFunctions and spec.commands withthem — creating the runtime block when the file has none. Only those blockschange; every comment, blank line, and other field is preserved byte-for-byte. Aplugin that imports no host functions or contributes no commands records anexplicit empty list, so each field is always present and reviewable.
The write is idempotent: re-running when the records already match the .wasmleaves the file untouched. Commit the result; publish (aggrega push) then onlyverifies the committed records against the .wasm and refuses to publish a filewhose records are out of sync with its binary.aggrega plugin sync 旗標
| 旗標 | 預設 | 說明 |
|---|---|---|
--plugin | — | 外掛程式 .wasm 成品的路徑,其匯入與 describe() 決定所記錄的主機函式與命令 |
importer 項目做什麼
aggrega plugin add importer 會把外掛程式的身分,以及為它發布的最新版本(或你以 <name>:<version> 指名的版本,即 importer/<name>:<version>)寫入 plugins.importer 清單。該項目會附加它所指名的匯入器:要求匯入器所公告之格式的匯入,會以該版本執行那個匯入器,即使你目錄中的其他匯入器也公告了該格式,而且只有那個匯入器會拿到該項目在 with 之下所攜帶的內容。由哪個匯入器將來源轉成草稿完整說明了該項目。
importer 由一個項目附加,因此加入一個被寫入檔案的 plugins.importer 清單已指名的 importer(無論任何版本,或以範圍指名)不會新增第二個項目。此命令改為把該項目移到它所解析出的版本:項目在清單中保持原位,它在 with 之下所攜帶的一切也都保留。以其項目已指名的版本加入 importer,則項目保持原樣。
CLI 外掛程式的命令及其旗標
每次 aggrega 啟動時,它會為每個已設定的 cli 外掛程式所貢獻的每個命令加入一個命令,並從外掛程式的 describe() 自我回報讀取命令及其旗標:當 describe 快取持有外掛程式所固定的摘要時就從快取讀取,否則就透過描述外掛程式取得。每個已宣告的旗標都宣告在其命令上,因此 aggrega help <command> 會像列出內建命令的旗標那樣列出它;外掛程式仍會收到未解析的引數,並自行讀取它的旗標。
固定的摘要位於設定的 plugins.cli 清單中外掛程式參照的旁邊,寫成 sha256: 後接 64 個小寫十六進位數字,即 aggrega plugin add cli 所記錄的寫法。以任何其他方式寫成的摘要(例如沒有 sha256: 前綴的純十六進位)會在設定檔載入時被拒絕,並指出檔案與項目;在它被更正之前,不會加入任何已設定外掛程式的命令,標準錯誤上的警告會帶出該拒絕。
在加入外掛程式的任何命令之前,aggrega 會檢查它們各自宣告的每個旗標。宣告未通過的外掛程式會被略過:它的命令一個都不會加入,標準錯誤上的一則警告會指出外掛程式、命令、旗標與其問題,而其他每個命令(無論是內建的或來自另一個外掛程式的)都照常執行:
warning: CLI plugin "oci://hub.aggrega.ai/plugin/cli/greet:1.2.0" was not added as a command: its command "greet" declares the flag "--verbose" with the shorthand "vv"; a shorthand is a single ASCII letter or digit旗標宣告在以下情況下通過:
- 旗標有名稱,且同一命令的其他旗標沒有相同的名稱;
- 其簡寫(若有)是單一個 ASCII 字母或數字,且同一命令的其他旗標沒有使用;
- 其名稱與簡寫都沒有重複使用每個
aggrega命令已有的旗標,即--help、-h與全域旗標; - 其型別(若有宣告)是
string、bool或int,沒有型別的旗標是字串旗標; - 其預設值(若有宣告)是其型別的值。
這個略過會在每次叫用時重複,並附上其警告,直到設定固定了一個宣告通過的外掛程式版本為止。旗標宣告所攜帶的欄位,在 Plugin 實體頁面 的 spec.commands 之下說明。
產生實體與同步記錄:兩種不同的行為
這些子命令中有兩個會產生檔案,而它們產生的並不是同一種東西。
plugin gen-catalog — 產生的實體由你編輯
aggrega plugin gen-catalog 會產生 Plugin 目錄實體。實體是目錄文件:你把它歸檔、審查,並與目錄的其餘部分一起繼續編輯。因為它是你擁有的內容,此命令可以把它交給你,而不是放到磁碟上。
--dry-run 除了寫入之外,做 gen-catalog 所做的一切。它以內容傳回所產生的實體,不建立檔案、不建立目錄,答案中的每份文件都指出它所屬的檔案,因此呼叫端知道每一份該放在哪裡。擁有自己文件模型的呼叫端(例如編輯器)會把內容放在那裡,你在它被儲存之前就能看到,並可修改或復原。沒有此旗標時,實體會寫在 --output-dir 之下,因為在終端機的呼叫端沒有更好的地方可以放它們。
傳回的內容與寫入的位元組是同一份內容:--dry-run 傳回的是寫入將會產生的內容,而不是另外組裝的預覽。其他所有行為也與寫入相同,會讀取相同的客體、比對相同的覆蓋層,而且兩種情況下都必須提供 --output-dir,因為每份傳回的文件仍會指出它所屬的檔案,而該路徑就是由它組成的。
每個實體都會在任何一個被交付之前先組成並驗證,因此一次執行不是產生整組,就是什麼都不產生。使產生中止的覆蓋層(缺少的,或其身分與所合併的客體不符的)不會留下需要清理的寫到一半的輸出。
plugin sync — 由機器擁有的記錄屬於編譯器
aggrega plugin sync 會讓外掛程式由機器擁有的記錄與其模組保持同步:由模組的匯入區段推導出的主機函式集合,以及從外掛程式自身的自我回報讀取的命令鏡像。兩者都是二進位檔中的基本事實,而不是任何人選擇的值。
它一律會寫入,且不提供 --dry-run。即使它寫入的是你撰寫之實體檔案的內部,也是如此,界線是畫在內容上,而不是檔案上。編譯器自己維護的關於自身的記錄不是你要編輯的,因此在它們寫入之前沒有什麼需要審查;周圍的文件逐位元組保持不變,只有那些區塊會改變。