Plugin catalog and installation
Plugin catalogs are trusted sources of plugin descriptions and package releases. The catalog and installation flow lets an engineer find a plugin, check whether it fits the current Sofka build and platform, install a verified package, and keep that package tied to its source. This page is a child of Plugin ecosystem and complements Plugin runtime and adapters.
Catalog source resolution
Source configuration
Plugin commands resolve their sources from src/…/sources.rs. A source is either the official catalog or a named custom catalog in catalogs.toml. The file is separate from cluster configuration, so catalog lookup does not require cluster credentials.
The source rules are:
- The official catalog is enabled by default.
official = falsedisables it. - A custom source needs a unique lower-case name, a location, and
trusted = true. - A location can be a local path, a
file://path, or an HTTP/HTTPS index URL. - A selected
--catalog NAMElimits the command to that source. - Without a selection, enabled sources are combined. An ID found in more than one source is ambiguous and needs
--catalog.
Trust means that Sofka accepts the source for installation. It does not sandbox the plugin or its external tools. Review a custom source before enabling it.
References: src/…/sources.rs• L4-34 src/…/sources.rs• L189-282 docs/plugins.md• L272-318
Catalog loading and caching
The official source resolves a catalog revision before it reads the index. Custom sources read the configured index directly. Each loaded index is parsed and checked before Sofka uses it, then cached by source identity for later offline commands.
Metadata and package archives have separate cache needs:
| Command mode | Required data |
|---|---|
| Online search or describe | A current index from each selected source |
| Offline search or describe | Cached index metadata for each selected source |
| Online install or update | Index metadata plus the selected package archive |
| Offline install or update | Cached index metadata plus the matching cached archive, or local source files |
Sofka does not silently replace a failed network request with old metadata. When it uses cached data, it reports the cache age because withdrawal information can be stale. A source's identity stays with the installation, which prevents a different location from taking ownership of an existing package.
References: src/plugin_catalog.rs• L689-783 src/…/sources.rs• L129-162 src/…/sources.rs• L328-358 docs/plugins.md• L70-74 docs/plugins.md• L322-350
Download boundaries
Custom source artifacts stay within the source that published the index. HTTP artifacts and redirects must keep the same scheme, host, port, and origin. Local artifacts must remain inside the directory that contains the index, including after symbolic-link resolution.
The official source accepts its known GitHub catalog and release locations. All package downloads still have size and progress limits. These boundaries make a catalog entry point to the package that the source intended, rather than to an unrelated host or local file.
References: src/…/sources.rs• L40-127 src/plugin_catalog.rs• L617-635 src/plugin_catalog.rs• L1013-1184 docs/plugins.md• L295-307
Catalog metadata
Plugin identity and release data
The catalog describes a plugin at two levels. A plugin entry gives its stable ID and human-facing information. A release entry gives the version that Sofka can select and the package data needed to install it.
| Metadata group | Purpose |
|---|---|
| Identity | ID, display name, description, tags, publisher, repository |
| Release support | Package version, Sofka version range, source commit, license, README |
| Runtime needs | External tools and installation guidance |
| Execution behavior | One legacy command or a schema 2 list of commands with scope and safety data |
| Availability | Active or withdrawn status with a withdrawal reason when needed |
| Package delivery | Platform, URL, size, and BLAKE3 digest for each artifact |
Schema 1 and schema 2 catalogs remain readable. Schema 2 can describe several commands in one package. A release is not installable merely because it is listed: it must be active, stable, compatible with the current Sofka version, and have an artifact for the current platform or any.
Package metadata now also supports an optional display name for the package as a whole. This name is separate from the names of the commands that the package provides. A package that uses this field must declare a Sofka version range that includes support for package display names; this keeps newer catalog metadata from being shown as valid on older Sofka versions. The package metadata also describes published platforms and tool requirements, while command metadata continues to describe execution behavior.
References: src/plugin_catalog.rs• L48-85 src/plugin_catalog.rs• L88-123 src/plugin_catalog.rs• L193-214 src/plugins.rs• L164-210 src/plugins.rs• L213-297 docs/plugins.md• L102-120
Version selection
An unversioned request such as resource-summary selects the highest compatible stable release with an artifact for the current platform. A versioned request such as resource-summary@1.2.0 names one exact release instead. Withdrawn releases are never chosen for an unversioned install, and an explicit request still fails with the withdrawal reason.
Search and describe use the same catalog facts as installation. They show compatibility, installed state, platform support, requirements, execution safety, and withdrawal information so a user can understand why a release can or cannot be used before changing the local installation.
References: src/plugin_catalog.rs• L423-529 src/plugin_catalog.rs• L542-565 src/plugin_cli.rs• L207-323 src/plugin_cli.rs• L824-855
CLI operations
Catalog inspection
The sofka plugin command exposes catalog inspection without opening the TUI, connecting to Kubernetes, or running an adapter. Search finds IDs, names, descriptions, and tags. Describe shows one selected release and its behavior. Both commands can emit stable JSON for tools that need catalog data.
| Operation | Main purpose | Source and network behavior |
|---|---|---|
search [QUERY] | Find available plugins and show compatibility and install state | Loads enabled or selected catalogs; --offline uses cached metadata |
describe ID[@VERSION] | Inspect release metadata, requirements, platforms, and safety behavior | Loads metadata; exact versions can include withdrawn releases for explanation |
list | Show managed and manual packages on disk | Does not use the network; cached metadata can add withdrawal information |
Catalog names appear in search and describe output. List reports the stored source for managed packages, which is important when several sources publish the same ID.
References: src/plugin_cli.rs• L14-77 src/plugin_cli.rs• L168-204 src/plugin_cli.rs• L326-405 src/plugin_cli.rs• L690-751 docs/plugins.md• L50-60 docs/plugins.md• L102-114
Installation operations
Installation commands change managed packages without needing a cluster. They accept one or more IDs, and each ID may include an exact version. Update acts on selected managed IDs or on all managed packages when no IDs are supplied. Remove accepts IDs only.
The command meanings are:
install ID[@VERSION]installs the selected release or explicitly rolls back to the requested version.update [ID ...]moves managed packages to the latest compatible release and reports packages that need attention.remove ID ...deactivates and removes managed packages.--catalog NAMEscopes search, describe, install, and update. It does not apply to list or remove.--offlineuses cached metadata and archives where the operation needs them.
After an install, update, or removal changes a package, an existing Sofka session needs :reload before it can use the new package set.
References: src/plugin_cli.rs• L140-165 src/plugin_cli.rs• L407-543 src/plugin_cli.rs• L754-773 docs/plugins.md• L62-68 docs/plugins.md• L99-100
Installation workflow
Package preparation
The installation flow turns a catalog selection into a complete package directory. It first resolves the release and artifact, then obtains the archive and checks its declared size and BLAKE3 digest. It extracts into a staging area rather than changing the active package in place.
The package must also pass archive and manifest checks. Sofka rejects unsafe paths, links, special files, excessive archive size or file count, and an archive without a root plugin.toml. Missing external tools produce warnings and installation guidance; Sofka does not install those tools.
This diagram shows how catalog facts and package contents meet before activation.
flowchart LR
A[Catalog request] --> B[Select release and platform artifact]
B --> C[Download or read cached archive]
C --> D[Check size and BLAKE3]
D --> E[Extract into staging area]
E --> F[Read and validate plugin manifest]
F --> G[Compare manifest with catalog metadata]
G --> H[Ready package]
References: src/plugin_install.rs• L240-395 src/plugin_install.rs• L832-987 src/plugin_catalog.rs• L819-925 src/plugin_cli.rs• L776-821
Catalog and package agreement
The catalog is the public description of a release, while plugin.toml is the package's own description of what Sofka will run. Installation compares these two views before activation. The version, Sofka requirement, command identity, arguments, scopes, executable, output mode, and safety settings must agree.
This check protects the user from a publishing error in which describe reports safe behavior but the archive runs different commands. It also keeps the catalog source and release revision in the installation record for later updates.
References: src/plugin_install.rs• L398-445 src/plugin_install.rs• L364-379 src/plugins.rs• L339-415 docs/plugin-authoring.md• L206-209
Activation and ownership
Activation replaces a managed package as a complete directory after preparation succeeds. A lock allows only one plugin operation at a time, and recovery handles staging or cleanup state left by an interrupted operation. Existing managed packages can be updated or rolled back, but a package from another source cannot replace the installed source in place.
Each managed package has an installation record with its source identity, catalog revision, package version, source commit, artifact digest, and per-file hashes. These records let list and update distinguish managed packages from manual packages and detect local edits before an update or removal.
References: src/plugin_install.rs• L16-78 src/plugin_install.rs• L144-228 src/plugin_install.rs• L478-592 src/plugin_install.rs• L681-738 docs/plugins.md• L76-88
Definition validation
Catalog validation
Catalog validation checks that available definitions are internally consistent before search or installation uses them. It rejects unsupported schemas, invalid or duplicate IDs and versions, incomplete metadata, invalid Sofka requirements, invalid command definitions, inconsistent withdrawal state, missing artifacts, duplicate platforms, and bad artifact declarations.
Validation also enforces source-specific URL rules. Official metadata and artifacts use the official HTTPS locations. Custom definitions may use the rules of their trusted local or network source. Unknown additive fields remain possible within supported schemas, but a future schema version is rejected clearly.
References: src/plugin_catalog.rs• L240-421 src/plugin_catalog.rs• L612-635 src/plugin_catalog.rs• L1364-1387 tests/plugin_catalogs.rs• L174-201
Installed package validation
The installer validates the archive before it becomes active, then records hashes for the extracted files. Later operations can compare the directory with that record. A changed, missing, added, symlinked, or unmanaged package is not treated as a safe managed target for update or removal.
This model separates two cases: a package can be listed as a manual package when Sofka did not install it, while a managed package with local edits remains visible but is refused for destructive changes. The distinction avoids overwriting files that Sofka does not own.
References: src/plugin_install.rs• L514-603 src/plugin_install.rs• L706-787 src/plugin_install.rs• L938-987 tests/plugin_catalogs.rs• L135-201
Change checklist
When these files or sections are changed, remember to consider these:
- Keep source identity rules aligned with installation records, update filtering, and duplicate-ID selection.
- Keep catalog execution fields aligned with manifest reconciliation and the metadata returned by
describe. - Keep package publication metadata aligned with catalog generation, package display names, platform declarations, and Sofka compatibility checks.
- Keep artifact URL, size, and digest rules aligned for online downloads, cached archives, and local offline mirrors.
- Keep withdrawal and compatibility handling aligned across search, describe, list, install, and update.
- Keep the supported catalog schema behavior aligned with the catalog producer and with older installed package records.
- Keep activation and reload messages aligned with the session behavior described in Plugin runtime and adapters.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A custom source is not trusted or its configuration is invalid | Catalog commands stop instead of using a default source | Explicit trust, unique names and locations, and strict source parsing |
| The same plugin ID exists in more than one enabled source | An unscoped describe or install is rejected as ambiguous | Use --catalog NAME |
| The selected release has no compatible stable artifact | Install or update cannot select a package | Publish a compatible active release or choose an exact supported version |
| An archive size or BLAKE3 digest differs from the catalog | The archive is rejected before extraction or reuse | Republish matching metadata and package bytes |
| The archive manifest differs from catalog execution metadata | Installation stops before activation | Rebuild the archive or correct the catalog entry |
| A package manifest has invalid publication metadata or execution fields | The package is rejected before it can enter the catalog or load as a package | Keep required fields valid and use a supported schema |
| A managed package has local file changes | Update or removal refuses to take ownership of the changed state | Restore the package or manage the directory manually |
| A network catalog is unavailable while offline data is missing | The command fails rather than using stale or unrelated data | Fetch the source once or provide a complete local mirror |
Key files
| File | Why to read it |
|---|---|
| src/…/sources.rs | Defines source configuration, trust, source identity, origin limits, and per-source caching. |
| src/plugin_catalog.rs | Defines catalog metadata, validation, version selection, platform matching, caching, and artifact verification. |
| src/plugins.rs | Defines package publication metadata and manifest validation before catalog use or package loading. |
| src/plugin_cli.rs | Connects catalog and installation behavior to search, describe, install, update, list, and remove commands. |
| src/plugin_install.rs | Defines package preparation, catalog-to-manifest checks, installation records, activation, ownership, and recovery. |
| tests/plugin_catalogs.rs | Shows the end-to-end contracts for custom catalogs, offline installation, source ownership, ambiguity, checksums, updates, and completion. |
| docs/plugins.md | Gives the user-facing catalog, CLI, custom source, and offline mirror rules. |
| docs/plugin-authoring.md | Explains the package metadata that must agree with a published catalog release. |