registry

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Package registry provides TerraCi's plugin catalog and per-run plugin sets. Plugin packages register factories via init(); commands instantiate a fresh Registry from those factories for each app run. AppContext exposes only the registry's capability resolver surface to plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFactory added in v0.10.0

func RegisterFactory(factory Factory)

RegisterFactory adds a plugin factory to the global catalog. Called from init() in plugin packages. Panics on duplicate names (fail-fast at startup).

func Reset

func Reset()

Reset clears the global catalog. Only for testing.

Types

type Catalog added in v0.10.0

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

Catalog stores plugin factories and creates isolated per-command plugin sets.

func NewCatalog added in v0.10.0

func NewCatalog() *Catalog

NewCatalog creates an empty plugin factory catalog.

func (*Catalog) NewRegistry added in v0.10.0

func (c *Catalog) NewRegistry() *Registry

NewRegistry instantiates a fresh plugin set from this catalog.

func (*Catalog) RegisterFactory added in v0.10.0

func (c *Catalog) RegisterFactory(factory Factory)

RegisterFactory adds a plugin factory to this catalog.

func (*Catalog) Reset added in v0.10.0

func (c *Catalog) Reset()

Reset clears the catalog. Only for testing.

type Factory added in v0.10.0

type Factory func() plugin.Plugin

Factory constructs a fresh plugin instance.

type InitContributionError added in v0.10.7

type InitContributionError struct {
	Plugin string
	Err    error
}

InitContributionError wraps a plugin init contribution failure.

func (*InitContributionError) Error added in v0.10.7

func (e *InitContributionError) Error() string

func (*InitContributionError) Unwrap added in v0.10.7

func (e *InitContributionError) Unwrap() error

type InitContributorBinding added in v0.10.7

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

InitContributorBinding ties a config contribution builder to a plugin name.

func (InitContributorBinding) BuildInitConfig added in v0.10.7

func (b InitContributorBinding) BuildInitConfig(state *initwiz.StateMap) (*initwiz.InitContribution, error)

BuildInitConfig builds and validates one plugin init contribution.

func (InitContributorBinding) Plugin added in v0.10.7

func (b InitContributorBinding) Plugin() string

Plugin returns the contributing plugin name.

type InitGroupBinding added in v0.10.7

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

InitGroupBinding ties an init group to the plugin that contributed it.

func (InitGroupBinding) Group added in v0.10.7

Group returns a defensive group copy.

func (InitGroupBinding) Plugin added in v0.10.7

func (b InitGroupBinding) Plugin() string

Plugin returns the contributing plugin name.

type InitGroupError added in v0.10.7

type InitGroupError struct {
	Plugin string
	Err    error
}

InitGroupError wraps a plugin init group construction failure.

func (*InitGroupError) Error added in v0.10.7

func (e *InitGroupError) Error() string

func (*InitGroupError) Unwrap added in v0.10.7

func (e *InitGroupError) Unwrap() error

type InitProviderOption added in v0.10.7

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

InitProviderOption describes one CI provider option for init presentation.

func (InitProviderOption) Description added in v0.10.7

func (o InitProviderOption) Description() string

Description returns the provider description.

func (InitProviderOption) Name added in v0.10.7

func (o InitProviderOption) Name() string

Name returns the provider name.

type InitWizardSnapshot added in v0.10.7

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

InitWizardSnapshot is the registry-owned init wizard read model.

func (*InitWizardSnapshot) Contributors added in v0.10.7

func (s *InitWizardSnapshot) Contributors() []InitContributorBinding

Contributors returns defensive contributor bindings.

func (*InitWizardSnapshot) Groups added in v0.10.7

func (s *InitWizardSnapshot) Groups() []InitGroupBinding

Groups returns defensive contributed init group bindings.

func (*InitWizardSnapshot) ProviderOptions added in v0.10.7

func (s *InitWizardSnapshot) ProviderOptions() []InitProviderOption

ProviderOptions returns deterministic CI provider choices.

type PluginInventory added in v0.10.8

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

PluginInventory is a defensive plugin listing snapshot for tests and presentation code.

func (PluginInventory) Plugins added in v0.10.8

func (s PluginInventory) Plugins() []PluginInventoryItem

Plugins returns defensive inventory item copies.

type PluginInventoryItem added in v0.10.8

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

PluginInventoryItem describes one registered plugin and its public capabilities without exposing the plugin instance.

func (PluginInventoryItem) Description added in v0.10.8

func (i PluginInventoryItem) Description() string

Description returns the plugin description.

func (PluginInventoryItem) HasBlobStoreProvider added in v0.10.8

func (i PluginInventoryItem) HasBlobStoreProvider() bool

HasBlobStoreProvider reports whether the plugin contributes a blob store backend.

func (PluginInventoryItem) HasCIProvider added in v0.10.8

func (i PluginInventoryItem) HasCIProvider() bool

HasCIProvider reports whether the plugin contributes CI provider metadata.

func (PluginInventoryItem) HasChangeDetector added in v0.10.8

func (i PluginInventoryItem) HasChangeDetector() bool

HasChangeDetector reports whether the plugin contributes VCS change detection.

func (PluginInventoryItem) HasCommandProvider added in v0.10.8

func (i PluginInventoryItem) HasCommandProvider() bool

HasCommandProvider reports whether the plugin contributes CLI commands.

func (PluginInventoryItem) HasConfigLoader added in v0.10.8

func (i PluginInventoryItem) HasConfigLoader() bool

HasConfigLoader reports whether the plugin loads extension config.

func (PluginInventoryItem) HasInitContributor added in v0.10.8

func (i PluginInventoryItem) HasInitContributor() bool

HasInitContributor reports whether the plugin contributes init wizard config.

func (PluginInventoryItem) HasKVCacheProvider added in v0.10.8

func (i PluginInventoryItem) HasKVCacheProvider() bool

HasKVCacheProvider reports whether the plugin contributes a KV cache backend.

func (PluginInventoryItem) HasPipelineContributor added in v0.10.8

func (i PluginInventoryItem) HasPipelineContributor() bool

HasPipelineContributor reports whether the plugin contributes pipeline jobs.

func (PluginInventoryItem) HasPreflight added in v0.10.8

func (i PluginInventoryItem) HasPreflight() bool

HasPreflight reports whether the plugin contributes startup preflight.

func (PluginInventoryItem) HasVersionProvider added in v0.10.8

func (i PluginInventoryItem) HasVersionProvider() bool

HasVersionProvider reports whether the plugin contributes version metadata.

func (PluginInventoryItem) Name added in v0.10.8

func (i PluginInventoryItem) Name() string

Name returns the plugin name.

type PluginSummary added in v0.10.7

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

PluginSummary describes one registered plugin for presentation.

func (PluginSummary) Description added in v0.10.7

func (s PluginSummary) Description() string

Description returns the plugin description.

func (PluginSummary) Name added in v0.10.7

func (s PluginSummary) Name() string

Name returns the plugin name.

type Registry added in v0.10.0

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

Registry is an isolated plugin instance set for one app run. It is the framework-owned catalog for lifecycle facades, command binding lookup, and plugin-visible capability resolution.

func New added in v0.10.0

func New() *Registry

New instantiates a fresh plugin set from the registered global factories.

func NewFromFactories added in v0.10.0

func NewFromFactories(factories ...Factory) *Registry

NewFromFactories creates an isolated registry from explicit factories without touching the process-wide plugin catalog.

func (*Registry) CollectContributions added in v0.10.0

func (r *Registry) CollectContributions(ctx *plugin.AppContext) (pipeline.ContributionSet, error)

CollectContributions gathers pipeline contributions from all enabled PipelineContributor plugins in this registry.

func (*Registry) Commands added in v0.10.7

func (r *Registry) Commands() ([]*cobra.Command, error)

Commands returns plugin-provided cobra commands in registration order.

func (*Registry) DecodeConfig added in v0.10.7

func (r *Registry) DecodeConfig(cfg config.Config) error

DecodeConfig applies extension config documents to config-capable plugins.

func (*Registry) ExtensionDefinitions added in v0.10.8

func (r *Registry) ExtensionDefinitions() (config.ExtensionDefinitionSet, error)

ExtensionDefinitions returns extension JSON schema definitions by config key.

func (*Registry) InitWizardSnapshot added in v0.10.7

func (r *Registry) InitWizardSnapshot() (*InitWizardSnapshot, error)

InitWizardSnapshot returns init wizard contributors, provider options, and groups.

func (*Registry) Inventory added in v0.10.8

func (r *Registry) Inventory() PluginInventory

Inventory returns plugin names, descriptions, and capability flags.

func (*Registry) LookupCommandPlugin added in v0.10.8

func (r *Registry) LookupCommandPlugin(name string) (plugin.Plugin, bool)

LookupCommandPlugin resolves a command-scoped plugin by name for plugin.CommandBinding.

func (*Registry) ResolveBlobStoreProvider added in v0.10.0

func (r *Registry) ResolveBlobStoreProvider(name string, configPathHint ...string) (plugin.BlobStoreProvider, error)

ResolveBlobStoreProvider returns a named blob store backend provider. When name is empty, falls back to the single enabled blob store provider.

func (*Registry) ResolveCIProvider added in v0.10.0

func (r *Registry) ResolveCIProvider() (*plugin.ResolvedCIProvider, error)

ResolveCIProvider detects the active CI provider in this registry. Priority: TERRACI_PROVIDER env → CI environment detection → single active provider → error.

func (*Registry) ResolveChangeDetector added in v0.10.0

func (r *Registry) ResolveChangeDetector() (plugin.ChangeDetectionProvider, error)

ResolveChangeDetector returns the single active ChangeDetectionProvider.

func (*Registry) ResolveKVCacheProvider added in v0.10.0

func (r *Registry) ResolveKVCacheProvider(name string, configPathHint ...string) (plugin.KVCacheProvider, error)

ResolveKVCacheProvider returns a named KV cache backend provider. When name is empty, falls back to the single enabled KV cache provider — otherwise returns an error pointing at the available backends.

func (*Registry) RunPreflight added in v0.10.7

func (r *Registry) RunPreflight(ctx context.Context, appCtx *plugin.AppContext) error

RunPreflight runs enabled plugin preflights in registration order.

func (*Registry) VersionSnapshot added in v0.10.7

func (r *Registry) VersionSnapshot() VersionSnapshot

VersionSnapshot returns version info and plugin summaries.

type VersionSnapshot added in v0.10.7

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

VersionSnapshot is the registry-owned version command read model.

func (VersionSnapshot) Info added in v0.10.7

func (s VersionSnapshot) Info() map[string]string

Info returns defensive version info key/value copies.

func (VersionSnapshot) Plugins added in v0.10.7

func (s VersionSnapshot) Plugins() []PluginSummary

Plugins returns registered plugin summaries in registration order.

Jump to

Keyboard shortcuts

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