Introducing a new way to review your PRs.

Read the announcement

nklmilojevic / sofka

A Kubernetes TUI, reimagined in Rust - built on kube-rs and ratatui, async-first from the ground up.

View on GitHub

19 documents · Updated Nov 4, 2026

docs / plugin-catalog-and-installation

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 = false disables 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 NAME limits 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 modeRequired data
Online search or describeA current index from each selected source
Offline search or describeCached index metadata for each selected source
Online install or updateIndex metadata plus the selected package archive
Offline install or updateCached 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 groupPurpose
IdentityID, display name, description, tags, publisher, repository
Release supportPackage version, Sofka version range, source commit, license, README
Runtime needsExternal tools and installation guidance
Execution behaviorOne legacy command or a schema 2 list of commands with scope and safety data
AvailabilityActive or withdrawn status with a withdrawal reason when needed
Package deliveryPlatform, 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.

OperationMain purposeSource and network behavior
search [QUERY]Find available plugins and show compatibility and install stateLoads enabled or selected catalogs; --offline uses cached metadata
describe ID[@VERSION]Inspect release metadata, requirements, platforms, and safety behaviorLoads metadata; exact versions can include withdrawn releases for explanation
listShow managed and manual packages on diskDoes 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 NAME scopes search, describe, install, and update. It does not apply to list or remove.
  • --offline uses 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

TriggerConsequenceGuard
A custom source is not trusted or its configuration is invalidCatalog commands stop instead of using a default sourceExplicit trust, unique names and locations, and strict source parsing
The same plugin ID exists in more than one enabled sourceAn unscoped describe or install is rejected as ambiguousUse --catalog NAME
The selected release has no compatible stable artifactInstall or update cannot select a packagePublish a compatible active release or choose an exact supported version
An archive size or BLAKE3 digest differs from the catalogThe archive is rejected before extraction or reuseRepublish matching metadata and package bytes
The archive manifest differs from catalog execution metadataInstallation stops before activationRebuild the archive or correct the catalog entry
A package manifest has invalid publication metadata or execution fieldsThe package is rejected before it can enter the catalog or load as a packageKeep required fields valid and use a supported schema
A managed package has local file changesUpdate or removal refuses to take ownership of the changed stateRestore the package or manage the directory manually
A network catalog is unavailable while offline data is missingThe command fails rather than using stale or unrelated dataFetch the source once or provide a complete local mirror

Key files

FileWhy to read it
src/…/sources.rsDefines source configuration, trust, source identity, origin limits, and per-source caching.
src/plugin_catalog.rsDefines catalog metadata, validation, version selection, platform matching, caching, and artifact verification.
src/plugins.rsDefines package publication metadata and manifest validation before catalog use or package loading.
src/plugin_cli.rsConnects catalog and installation behavior to search, describe, install, update, list, and remove commands.
src/plugin_install.rsDefines package preparation, catalog-to-manifest checks, installation records, activation, ownership, and recovery.
tests/plugin_catalogs.rsShows the end-to-end contracts for custom catalogs, offline installation, source ownership, ambiguity, checksums, updates, and completion.
docs/plugins.mdGives the user-facing catalog, CLI, custom source, and offline mirror rules.
docs/plugin-authoring.mdExplains the package metadata that must agree with a published catalog release.