skillreg

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package skillreg installs skills from registries (spec_013_skills SK-90..SK-96): a registry is a URL serving a JSON index of skills, each a .zip archive pinned by its SHA-256, as the Castor skills registry or anyone else can serve it. The registries the user added, and the skills installed from them, are kept in ~/.blitz/skill-registries.toml; a registry's token is kept in the system keychain. Installed skills are ordinary skill folders (~/.blitz/skills/<name>, or a project's .agents/skills/<name>), loaded as any other, skills.policy and all.

Index

Constants

View Source
const IndexVersion = 1

IndexVersion is the index format this package reads.

Variables

View Source
var (
	ErrNoRegistry   = errors.New("no such registry")
	ErrNotOffered   = errors.New("no registry offers that skill")
	ErrAmbiguous    = errors.New("several registries offer that skill")
	ErrHash         = errors.New("the archive doesn't match the hash the registry gives")
	ErrNotInstalled = errors.New("not installed from a registry")
	ErrExists       = errors.New("a skill of that name is already there")
)

Errors.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Version     string `json:"version"`
	// ArchiveURL is the skill's .zip: absolute, or relative to the index.
	ArchiveURL string `json:"archive_url"`
	// SHA256 is the archive's hash, hex; an archive that doesn't match is
	// refused.
	SHA256 string `json:"sha256"`
	// CastorID is the skill's id in the Castor registry, when it has one.
	CastorID string `json:"castor_id,omitempty"`
}

Entry is a skill a registry offers.

type Found

type Found struct {
	Registry string
	Entry
}

Found is a search hit: a registry's entry.

type Index

type Index struct {
	Version int     `json:"version"`
	Name    string  `json:"name"`
	Skills  []Entry `json:"skills"`
}

Index is what a registry serves.

type Installed

type Installed struct {
	Name     string    `toml:"name"`
	Registry string    `toml:"registry"`
	Version  string    `toml:"version"`
	SHA256   string    `toml:"sha256"`
	Dir      string    `toml:"dir"` // the skill's folder
	Time     time.Time `toml:"time"`
}

Installed is a skill installed from a registry.

type Registry

type Registry struct {
	Name string `toml:"name"`
	URL  string `toml:"url"`
}

Registry is one the user added.

type Store

type Store struct {
	// File holds the registries and the install records.
	File string
	// UserSkills is where a skill for the user goes.
	UserSkills string
	// Secrets keeps registries' tokens.
	Secrets secrets.Store
	// Client fetches indexes and archives (default: one with a timeout).
	Client *http.Client
}

Store is the user's registries and the skills installed from them.

func Default

func Default() *Store

Default is the user's store.

func (*Store) Add

func (s *Store) Add(ctx context.Context, name, rawURL, token string) (*Index, error)

Add checks the index at rawURL and remembers the registry as name (the index's own name when empty), with token for it (kept in the keychain; "" for none). It replaces a registry of the same name.

func (*Store) HasToken

func (s *Store) HasToken(name string) bool

HasToken reports whether the registry has a token in the keychain.

func (*Store) Install

func (s *Store) Install(ctx context.Context, ref, projectDir string) (Installed, error)

Install fetches the skill ref names ("registry/name", or a name one registry offers), checks its archive's hash, and installs it for the user, or in the project at projectDir (.agents/skills) when that isn't "". It replaces a skill it installed before, never one it didn't.

func (*Store) Installed

func (s *Store) Installed() ([]Installed, error)

Installed lists the skills installed from registries.

func (*Store) Registries

func (s *Store) Registries() ([]Registry, error)

Registries are those the user added, by name.

func (*Store) Remove

func (s *Store) Remove(name string) error

Remove forgets a registry and its token; skills installed from it stay.

func (*Store) Search

func (s *Store) Search(ctx context.Context, query string) ([]Found, error)

Search returns the skills whose name or description has every word of query (all of them for ""), from every registry; a registry that can't be read is reported in err while the others' hits still come back.

func (*Store) Uninstall

func (s *Store) Uninstall(name, projectDir string) (Installed, error)

Uninstall removes a skill installed from a registry (the project's at projectDir, or the user's when the project has none of that name or projectDir is empty), and its record; a skill it didn't install is left alone.

func (*Store) Update

func (s *Store) Update(ctx context.Context, names ...string) ([]Installed, error)

Update reinstalls the skills installed from registries (those named, or all) whose registry now offers another version or archive. It returns those it updated.

Jump to

Keyboard shortcuts

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