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 ¶
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 ¶
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.
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 ¶
func (b *LegacyBuilder) Build() (*toolhiveRegistry.Registry, error)
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 (*Loader) GetEntries ¶
func (l *Loader) GetEntries() map[string]upstream.ServerJSON
GetEntries returns all loaded server.json entries keyed by directory name.
func (*Loader) GetSortedNames ¶
GetSortedNames returns directory names in sorted order for deterministic output.
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.