registry

package
v0.20260321.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package registry provides functionality for loading server.json files and building the aggregate upstream registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder assembles an UpstreamRegistry from loaded ServerJSON entries and optional skills.

func NewBuilder

func NewBuilder(loader *Loader) *Builder

NewBuilder creates a new Builder backed by the given Loader.

func (*Builder) Build

func (b *Builder) Build() *thvregistry.UpstreamRegistry

Build creates the UpstreamRegistry structure from loaded entries. Servers and skills are ordered by directory name for deterministic output.

func (*Builder) ValidateAgainstSchema

func (b *Builder) ValidateAgainstSchema() error

ValidateAgainstSchema builds the registry and validates it without writing.

func (*Builder) WithSkillLoader added in v0.20260313.0

func (b *Builder) WithSkillLoader(sl *SkillLoader) *Builder

WithSkillLoader sets the skill loader on the builder.

func (*Builder) WriteJSON

func (b *Builder) WriteJSON(path string) error

WriteJSON builds the registry, validates it, and writes JSON to the given path.

type LegacyBuilder

type LegacyBuilder struct {
	// contains filtered or unexported fields
}

LegacyBuilder assembles a legacy toolhive Registry from loaded ServerJSON entries. It converts each ServerJSON back to ImageMetadata or RemoteServerMetadata using the converters package.

func NewLegacyBuilder

func NewLegacyBuilder(loader *Loader) *LegacyBuilder

NewLegacyBuilder creates a new LegacyBuilder backed by the given Loader.

func (*LegacyBuilder) Build

Build creates the legacy toolhive Registry structure from loaded ServerJSON entries. Entries are processed in sorted order for deterministic output.

func (*LegacyBuilder) ValidateAgainstSchema

func (b *LegacyBuilder) ValidateAgainstSchema() error

ValidateAgainstSchema builds the legacy registry and validates it without writing.

func (*LegacyBuilder) WriteJSON

func (b *LegacyBuilder) WriteJSON(path string) error

WriteJSON builds the legacy registry, validates it, and writes JSON to the given path.

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader walks a servers directory and loads server.json files into memory.

func NewLoader

func NewLoader(serversPath string) *Loader

NewLoader creates a new Loader that reads from the given servers directory.

func (*Loader) GetEntries

func (l *Loader) GetEntries() map[string]upstream.ServerJSON

GetEntries returns all loaded server.json entries keyed by directory name.

func (*Loader) GetSortedNames

func (l *Loader) GetSortedNames() []string

GetSortedNames returns directory names in sorted order for deterministic output.

func (*Loader) LoadAll

func (l *Loader) LoadAll() error

LoadAll walks top-level subdirectories under serversPath, reads server.json from each, and stores the results keyed by directory name. Hidden directories (starting with ".") are skipped. Returns an error if any server.json contains malformed JSON.

type SkillLoader added in v0.20260313.0

type SkillLoader struct {
	// contains filtered or unexported fields
}

SkillLoader walks a skills directory and loads skill.json files into memory.

func NewSkillLoader added in v0.20260313.0

func NewSkillLoader(skillsPath string) *SkillLoader

NewSkillLoader creates a new SkillLoader that reads from the given skills directory.

func (*SkillLoader) GetEntries added in v0.20260313.0

func (l *SkillLoader) GetEntries() map[string]thvregistry.Skill

GetEntries returns all loaded skill.json entries keyed by directory name.

func (*SkillLoader) GetSortedNames added in v0.20260313.0

func (l *SkillLoader) GetSortedNames() []string

GetSortedNames returns directory names in sorted order for deterministic output.

func (*SkillLoader) LoadAll added in v0.20260313.0

func (l *SkillLoader) LoadAll() error

LoadAll walks top-level subdirectories under skillsPath, reads skill.json from each, and stores the results keyed by directory name. Hidden directories (starting with ".") are skipped. Returns an error if any skill.json contains malformed JSON.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL