registry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkillNotFound = errors.New("registry: skill not found")

ErrSkillNotFound is returned when a skill cannot be located in storage.

Functions

This section is empty.

Types

type LoadedSkill

type LoadedSkill struct {
	// Skill holds the parsed SKILL.md metadata and instructions.
	Skill *skill.Skill

	// Dir is the absolute path to the temporary directory containing the
	// extracted skill files. The caller is responsible for removing this
	// directory after use.
	Dir string

	// Entrypoint is the relative path (from Dir) to the main script
	// that should be executed (e.g. "main.py", "main.js", "main.sh").
	Entrypoint string

	// HasRequirements is true when a requirements.txt file is present
	// in the extracted archive, indicating Python dependencies.
	HasRequirements bool

	// HasPackageJSON is true when a package.json file is present in
	// the extracted archive, indicating Node.js dependencies.
	HasPackageJSON bool
}

LoadedSkill contains a fully validated skill ready for execution. It includes the parsed SKILL.md, the path to the extracted files on disk, the entrypoint script, and metadata about dependency files.

func LoadSkill

func LoadSkill(ctx context.Context, reg *Registry, tenantID, skillName, version string) (*LoadedSkill, error)

LoadSkill downloads a skill archive from the registry, extracts it to a temporary directory, validates its contents, and returns a LoadedSkill.

The caller MUST remove LoadedSkill.Dir when done (e.g. via os.RemoveAll).

Validation includes:

  • SKILL.md must exist and parse successfully
  • A recognized entrypoint script must exist
  • Zip entries are checked for path traversal (zip slip) attacks

type Registry

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

Registry provides skill archive storage backed by MinIO / S3-compatible object storage. Archives are stored as zip files keyed by tenant, skill name, and version.

func New

func New(endpoint, accessKey, secretKey, bucket string, useSSL bool) (*Registry, error)

New creates a Registry connected to the given S3/MinIO endpoint. It ensures the target bucket exists, creating it if necessary.

func (*Registry) Delete

func (r *Registry) Delete(ctx context.Context, tenantID, skillName, version string) error

Delete removes a skill archive from the registry. It returns ErrSkillNotFound if the archive does not exist.

func (*Registry) Download

func (r *Registry) Download(ctx context.Context, tenantID, skillName, version string) (io.ReadCloser, error)

Download returns a reader for the skill zip archive. The caller is responsible for closing the returned ReadCloser.

func (*Registry) List

func (r *Registry) List(ctx context.Context, tenantID string) ([]SkillMeta, error)

List returns metadata for all skill versions belonging to a tenant. It works by iterating over object prefixes under the tenant's namespace and extracting skill name, version, and upload timestamp from each matching object.

func (*Registry) ResolveLatest

func (r *Registry) ResolveLatest(ctx context.Context, tenantID, skillName string) (string, error)

ResolveLatest returns the version string of the most recently uploaded version of a skill. If no versions are found, it returns ErrSkillNotFound.

func (*Registry) Upload

func (r *Registry) Upload(ctx context.Context, tenantID, skillName, version string, zipData io.Reader, size int64) error

Upload stores a skill zip archive in the registry after validating that the provided data is a valid zip file (by checking zip headers). The archive is stored at {tenantID}/{skillName}/{version}/skill.zip.

type SkillMeta

type SkillMeta struct {
	Name       string    `json:"name"`
	Version    string    `json:"version"`
	UploadedAt time.Time `json:"uploaded_at"`
}

SkillMeta contains summary information about a skill version stored in the registry. It is returned by List.

Jump to

Keyboard shortcuts

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