registry

package
v0.0.0-...-f9a56e6 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package registry handles fetching CUE modules from the CUE Central Registry.

Index

Constants

View Source
const IndexModulePath = "github.com/start-cli/library/index@v1"

IndexModulePath is the CUE module path for the start library index. Uses major version; resolved to latest canonical version at runtime.

View Source
const SchemaModulePath = "github.com/start-cli/library/schemas@v1"

SchemaModulePath is the CUE module path for the start library schemas. Used by doctor to validate configs against schema constraints.

Variables

This section is empty.

Functions

func EffectiveIndexPath

func EffectiveIndexPath(configured string) string

EffectiveIndexPath returns configured if non-empty, otherwise IndexModulePath.

Types

type Client

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

Client fetches CUE modules from the registry with retry logic.

func NewClient

func NewClient() (*Client, error)

NewClient creates a registry client using CUE's standard configuration. It respects CUE_REGISTRY environment variable and cue login authentication.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, modulePath string) (FetchResult, error)

Fetch downloads a module from the registry with retry logic. The module path should include version, e.g., "github.com/user/repo/path@v0".

func (*Client) FetchIndex

func (c *Client) FetchIndex(ctx context.Context, indexPath string) (*Index, string, error)

FetchIndex fetches and parses the index from the registry. indexPath is the CUE module path to use; pass empty string to use IndexModulePath. Returns the parsed index, the resolved canonical version string, and any error.

func (*Client) ModuleVersions

func (c *Client) ModuleVersions(ctx context.Context, modulePath string) ([]string, error)

ModuleVersions returns available versions for a module path.

func (*Client) Registry

func (c *Client) Registry() modconfig.Registry

Registry returns the underlying modconfig.Registry for use with cue/load.

func (*Client) ResolveLatestVersion

func (c *Client) ResolveLatestVersion(ctx context.Context, modulePath string) (string, error)

ResolveLatestVersion resolves a module path with major version (e.g., @v0) to the latest canonical version (e.g., @v0.0.1).

type FetchResult

type FetchResult struct {
	// SourceDir is the filesystem path to the fetched module.
	SourceDir string
}

FetchResult contains the result of fetching a module.

type Index

type Index struct {
	Agents   map[string]IndexEntry `json:"agents,omitempty"`
	Roles    map[string]IndexEntry `json:"roles,omitempty"`
	Contexts map[string]IndexEntry `json:"contexts,omitempty"`
	Tasks    map[string]IndexEntry `json:"tasks,omitempty"`
}

Index represents the full library discovery index.

func LoadIndex

func LoadIndex(dir string, reg modconfig.Registry) (*Index, error)

LoadIndex loads and parses the index from a directory.

type IndexEntry

type IndexEntry struct {
	Module      string   `json:"module"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Version     string   `json:"version,omitempty"`
	Bin         string   `json:"bin,omitempty"`
}

IndexEntry represents an entry in the library index.

Jump to

Keyboard shortcuts

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