feat(registry/types): add Plugin catalog type (Phase 5a, THV-0077)#153
Merged
Conversation
Add the registry Plugin type to toolhive-core so toolhive and toolhive-registry-server can surface plugins in the catalog. This is GATE-C3 for the plugin lifecycle epic (stacklok/toolhive#5525). - registry/types/plugins_types.go: Plugin struct mirroring Skill (drops skill-only Compatibility/AllowedTools), reuses SkillPackage/SkillIcon/SkillRepository. - registry/types/data/plugin.schema.json: JSON schema mirroring skill.schema.json with plugin_* $defs. - registry/types/schema_validation.go: embed + preload plugin schema; add (*Plugin).Validate() and ValidatePluginBytes(). - registry/types/upstream_registry.go: add Plugins []Plugin (omitempty) to UpstreamData. - registry/types/data/upstream-registry.schema.json: optional plugins array $ref-ing plugin.schema.json. - Tests: marshal round-trip, Validate, ValidatePluginBytes, upstream-registry-with-plugins validation, boundary cases. Package coverage: 81.1%. Part of stacklok/toolhive#5525. Refs RFC stacklok/toolhive-rfcs#77.
jhrozek
approved these changes
Jul 8, 2026
jhrozek
left a comment
Contributor
There was a problem hiding this comment.
Approved. Clean, well-tested mirror of the existing Skill type/schema. Verified locally: go test -race ./registry/types/, golangci-lint, and task license-check all green; schema $id/$ref URLs align and the plugin schema is correctly wired into the embed + preload path.
One non-blocking note: Plugin reuses SkillRepository/SkillIcon/SkillPackage — fine as-is (structurally identical, both Alpha), but if these are expected to diverge, consider renaming the shared structs to neutral names before graduation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the registry
Plugintype totoolhive-coreso bothtoolhiveandtoolhive-registry-servercan surface plugins in the catalog. This is Phase 5a of the plugin lifecycle epic and the GATE-C3 cross-repo fan-out gate — once this is tagged andgo.modis bumped, it unblocks Phase 5b (toolhive) and Phase 5d (toolhive-registry-server).Closes #132. Part of stacklok/toolhive#5525. Refs RFC stacklok/toolhive-rfcs#77.
What changed
registry/types/plugins_types.go(new) —Pluginstruct mirroringSkill, dropping the skill-specificCompatibility/AllowedToolsfields. Reuses the existingSkillPackage/SkillIcon/SkillRepositorydistribution-primitive types.registry/types/data/plugin.schema.json(new) — JSON schema mirroringskill.schema.jsonwithplugin_*$defs; required fields (namespace, name, description, version); enum-constrainedstatus; pattern-constrainedname.registry/types/schema_validation.go—data/plugin.schema.jsonadded to//go:embedandreferencedSchemas;(*Plugin).Validate()andValidatePluginBytes()hooks wired in.registry/types/upstream_registry.go—Plugins []Plugin(omitempty) added toUpstreamDataso the type has a place in the registry contract.registry/types/data/upstream-registry.schema.json— optionalpluginsarray$ref-ingplugin.schema.json.Validate(),ValidatePluginBytes(), upstream-registry-with-plugins e2e validation, plus boundary cases (name pattern, status enum values, missing registryType, invalid plugin in registry). Table-driven,t.Parallel().CLAUDE.md— addedregistry/typesrow to the package table.Out of scope (later phases)
Per the RFC and the issue scope, this PR does not add: provider interface methods (
ListAvailablePlugins/GetPlugin/SearchPlugins), HTTP routes (/v0.1/x/dev.toolhive/plugins), thePluginsClient, ortoolhive-registry-servercatalog wiring — those are Phase 5b/5d in their respective repos. It also does not duplicate the build-timePluginManifest(that lives intoolhive/pkg/plugins/parser.go).Design note for reviewers
PluginreusesSkillPackage/SkillIcon/SkillRepository(rather than introducingPluginPackageetc.) and the plugin schema duplicates the$defslocally (rather than cross-$refingskill.schema.json). This is a deliberate choice to keep the change scoped and non-breaking for the Alpharegistry/typespackage, but it surfaces a follow-up worth discussing: extracting domain-neutral names (Package/Icon/Repository) + a shared$defsschema so theSkilldomain doesn't leak into the plugin contract. Flagged as a judgement call; not done here because it touches exported types (CLAUDE.md "Boundaries → Ask First").Verification
task lint— 0 issuestask test— all pass with-racetask test-coverage—registry/typesat 81.1% (≥70%)task license-check— passes (SPDX headers present)TestExternalRefsHaveEmbeddedSchemasinvariant still passes (the newplugins$refresolves from embedded bytes, no network fetch)