Перейти до вмісту
AggregaAggrega
Обрати мову: Українська
Цю сторінку перекладено машинним способом. Читати оригінал англійською.

aggrega plugin

Переглянути плагіни Wasm, які може розв’язати CLI

Синтаксис

aggrega plugin

Опис

Work with the WebAssembly plugins this CLI can resolve.
All of Aggrega's provider-specific and policy-specific behaviour lives in Wasm
plugins rather than in the binary, so this is where you see which ones are
reachable, add or remove a workspace binding, and check a guest before you
publish it.
Plugins reach the CLI two ways. Some are compiled into the binary and resolve
with 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 the
machine-owned records in a Plugin entity with its .wasm, and generate Plugin
catalog entities from a guest's own metadata.

Підкоманди

КомандаОпис
aggrega plugin addЗнаходить у реєстрі плагін указаного типу та додає його
aggrega plugin gen-catalogГенерує сутності каталогу Plugin з describe() гостя разом з авторським накладенням
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 your
configuration.
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 configuration
unless --global is passed, so outside a workspace it is refused before the
registry 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-run
does everything the plain command does except write: it hands back the
configuration the write would have produced, creating and modifying nothing. The
answer names the file that content is for — which matters here, because a
--global attachment targets the config shared across every workspace. A caller
that keeps its own document model puts the content there, where it is visible
before 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 document
carries the identity a write would have written.
Under --dry-run standard output carries that content and nothing else, so it stays
parseable; a version substitution is announced on standard error instead. The cli
type does not accept --dry-run: what it records is the content digest of the bytes
it verified, which is a record the machine maintains rather than content you
edit.

Прапорці aggrega plugin add

ПрапорецьЗа замовчуваннямОпис
--accept-capabilitiesfalseПрийняти оголошені можливості плагіна cli без інтерактивного запиту (лише для типу cli)
--capability—Можливість, яку обслуговує прив’язка провайдера (обов’язковий для типу provider і допустимий лише з ним)
--dry-runfalseВиконати все, крім запису: повернути результівну конфігурацію як вміст, назвавши файл, для якого вона призначена, і нічого не створювати й не змінювати. Без цього прапорця приєднання записується у розв’язаний файл конфігурації. Не приймається з типом cli.
--globalfalseЗаписати приєднання в глобальну конфігурацію, спільну для всіх робочих просторів.
--role—Роль приєднання governance: annotation-transform, label-transform, ir-verdict або render-verdict (обов’язковий для типу governance і допустимий лише з ним)
--workspacefalseЗаписати приєднання в конфігурацію робочого простору цього проєкту. Приєднання provider або socket за замовчуванням записується сюди; плагін cli за замовчуванням записується в глобальну конфігурацію.
--yesfalseПропустити запит підтвердження можливостей 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 the
entity can never promise a capability the binary does not provide. The entity's
identity (metadata.name), runtime limits, and provider block come from an authored
per-plugin overlay; the entity version is the guest's describe() self-report
version. The plugin-level description, when the guest reports one, is emitted as
metadata.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.yaml
and carries a generated-output banner. The leading pluginType segment keeps two
same-named plugins in different sockets apart, since a bare plugin name is unique
only within its own socket. Regenerating over unchanged inputs yields
byte-identical files.
A generated entity is a catalog document you own and go on editing, so --dry-run
does everything gen-catalog does except write: it hands the content back, creating
and modifying nothing, and the answer names the file each document is for. A
caller that keeps its own document model — an editor, for instance — puts the
content there, where it is visible before it is saved and can be amended or
undone. Every other behaviour is the write's — the same guests are read and the
same 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 a
terminal has nowhere better to put them.

Прапорці aggrega plugin gen-catalog

ПрапорецьЗа замовчуваннямОпис
--dry-runfalseВиконати все, крім запису: повернути згенеровані сутності як вміст, назвавши файл для кожної, і нічого не створювати й не змінювати. Решта поведінки така сама, як під час запису, тож вибір, який запис відхилив би, відхиляється й тут. Без цього прапорця сутності записуються в —output-dir.
--from-embeddedfalseзгенерувати сутність для кожного гостя, вбудованого в цей бінарний файл
--output-dir—каталог, у який записуються згенеровані сутності (обов’язковий)
--overlay—каталог (—from-embedded) або файл (—plugin) авторського накладення (обов’язковий)
--plugin—згенерувати одну сутність для гостя .wasm за цим шляхом

Опис aggrega plugin list

List every Wasm plugin the CLI can see and, for each, its self-reported
describe() metadata.
Two groups are printed. Embedded built-ins are the provider and linter guests
compiled into the binary; they resolve with no filesystem, cache, or network
access. Configured plugins are the workspace bindings — the provider and linter
bindings 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 a
status of its own — ready, unresolved, describe-failed, or digest-drift when
its bytes changed since it was pinned at install.
The default output is a scannable table with one row per plugin, showing its
type, name, served capabilities, and version. The output is read-only and
deterministic. A plugin that fails to resolve or describe is listed with its
failure status rather than halting the whole listing.
With -o json, the output is a structured object carrying the full per-plugin
detail — type, name, version, commit, capabilities, input kinds, boundary
assembly, exports, origin, readiness, and any resolve or describe error —
grouped as embedded and configured. It is suitable for programmatic
consumption and documentation generation.

Прапорці aggrega plugin list

ПрапорецьЗа замовчуваннямОпис
--output, -otableФормат виведення: table|json.

Опис aggrega plugin remove

Remove a configured plugin of the named type from a config file so it no longer
participates.
The type is one of provider, governance, linter, importer, or cli — the same
set 'plugin add' accepts. The query identifies the entry to remove: the plugin's
short 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 binding
serves. A query that matches nothing halts and leaves the config untouched, so a
typo never silently removes the wrong plugin.
A provider or socket attachment defaults to this project's workspace config; a cli
command defaults to the global config shared across every workspace. --global and
--workspace force the file the removal targets, overriding the default.

Прапорці aggrega plugin remove

ПрапорецьЗа замовчуваннямОпис
--globalfalseВидалити з глобальної конфігурації, спільної для всіх робочих просторів.
--workspacefalseВидалити з конфігурації робочого простору цього проєкту. Приєднання provider або socket за замовчуванням видаляється звідси; команда cli за замовчуванням видаляється з глобальної конфігурації.

Опис aggrega plugin run-local

Load a .wasm guest from a filesystem path, call one of its declared
exports with an optional payload, and write the guest's answer to stdout.
The guest is addressed directly by --plugin path; it is not resolved through
the workspace plugin cascade. The export named by --export must be one the
guest advertises in its describe() self-report, or the call is rejected before
the guest runs.
The command has two forms. The artifact form takes no positional argument and
loads the guest bare. The entity form takes a Plugin entity file as its one
positional argument: the entity is schema-validated, and its declared
metadata.pluginType and export contract are cross-checked against the guest's
describe() 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 value
beginning with @ reads the payload bytes from a file (--with @input.json); any
other value is taken as a literal inline JSON payload (--with '{"k":1}'). When
--with is omitted, the export receives the minimal empty JSON object {}. The
resolved payload is validated as JSON before the guest runs, so malformed input
is reported up front.
An export a socket calls with a payload reads it in a binary encoding rather
than 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 no
flag selects it: the resolved payload is converted into the encoding the named
export reads before the guest is called. The conversion reads the payload's
shape from the export's name, so it covers each export a socket calls by
default; an entry function an attachment or a pipeline step names under a name
of its own receives the payload as written. The authored payload stays JSON
either way.
The answer is converted the same way in reverse. An export a socket calls
answers in that binary encoding, so its answer is read as the export's output
shape and written to stdout as indented JSON; an answer that is not that shape
is reported as an error naming the export rather than printed. A cli_run
export's answer, and an entry function under a name of its own, are written to
stdout exactly as the guest wrote them. When the guest exits non-zero, what it
wrote is passed through unchanged.
In the artifact form, --type optionally names a plugin type the guest's
describe() self-report must agree with, or the load is rejected before the
guest 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 failure
inside 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 may
call, derived from the plugin's .wasm import section, and the top-level commands a
CLI plugin contributes, read from the plugin's describe() self-report. Both are
ground truth in the binary. This command reads the .wasm, derives the
host-function set in canonical form and the command mirror in describe()-declared
order, and aligns the entity's spec.runtime.hostFunctions and spec.commands with
them — creating the runtime block when the file has none. Only those blocks
change; every comment, blank line, and other field is preserved byte-for-byte. A
plugin that imports no host functions or contributes no commands records an
explicit empty list, so each field is always present and reviewable.
The write is idempotent: re-running when the records already match the .wasm
leaves the file untouched. Commit the result; publish (aggrega push) then only
verifies the committed records against the .wasm and refuses to publish a file
whose records are out of sync with its binary.

Прапорці aggrega plugin sync

ПрапорецьЗа замовчуваннямОпис
--plugin—Шлях до артефакту .wasm плагіна, імпорти та describe() якого визначають записані функції хоста й команди

Що робить запис імпортера

aggrega plugin add importer записує ідентичність плагіна та останню опубліковану для нього версію або версію, яку ви вказуєте як <name>:<version>, — importer/<name>:<version> — до списку plugins.importer. Цей запис під’єднує імпортер, який він називає: імпорт, що запитує формат, заявлений імпортером, запускає саме цей імпортер у цій версії, навіть якщо інші імпортери у вашому каталозі також заявляють цей формат, і лише цей імпортер отримує те, що запис містить у with. Розділ Який імпортер перетворює джерело на чернетки описує запис повністю.

Імпортер під’єднується одним записом, тож додавання імпортера, який список plugins.importer файлу, що записується, уже називає — у будь-якій версії або діапазоном, — не додає другого запису. Натомість команда переводить цей запис на версію, яку вона розв’язала: запис зберігає своє місце у списку та все, що він містить у with. Додавання імпортера у версії, яку його запис уже називає, залишає запис без змін.

Команди 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; прапорець без типу є рядковим;
  • його значення за замовчуванням, якщо воно оголошене, є значенням його типу.

Пропуск разом із попередженням повторюється під час кожного виклику, доки конфігурація не закріпить версію плагіна, оголошення якої проходять перевірку. Поля, які містить оголошення прапорця, описано в розділі spec.commands на сторінці Plugin (сторінка сутності).

Генерування сутностей і синхронізація записів: дві різні дії

Дві з цих підкоманд створюють файл, і те, що вони створюють, має різну природу.

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. Так є, навіть попри те, що вона записує в файл сутності, який створили ви: межу проведено за вмістом, а не за файлом. Записи, які компілятор веде про себе, не призначені для вашого редагування, тож переглядати перед їх появою нічого; навколишній документ залишається незмінним байт у байт, змінюються лише ці блоки.