skillhub

package
v0.32.43 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegistryURL  = "https://raw.githubusercontent.com/devlikebear/tars-skills/main/registry.json"
	DefaultSkillBaseURL = "https://raw.githubusercontent.com/devlikebear/tars-skills/main"
)
View Source
const DefaultSourceID = "tars-hub"

DefaultSourceID is the source identifier assigned to legacy InstalledSkill rows with an empty Source field and to entries from the built-in hub.

Variables

This section is empty.

Functions

func LoadInstalledMCPServers added in v0.9.0

func LoadInstalledMCPServers(workspaceDir string) ([]config.MCPServer, []string)

func LoadWorkspaceMCPServers added in v0.31.180

func LoadWorkspaceMCPServers(workspaceDir string) ([]config.MCPServer, []string)

func ResolveSkillRef added in v0.32.43

func ResolveSkillRef(ref string) (sourceID, name string)

ResolveSkillRef parses a user-facing reference like "openclaw:foo" and returns the source ID plus the bare skill name. An empty sourceID means "search every registered source" — the install path is expected to handle that ambiguity.

Whitespace around either component is trimmed. A trailing colon with no name (e.g. "openclaw:") yields the source plus an empty name. A leading colon (":foo") is treated as no source plus "foo".

Types

type HubSource added in v0.32.43

type HubSource interface {
	// ID returns the stable identifier used in `--from` flags and the
	// InstalledSkill.Source field (e.g. "tars-hub", "openclaw").
	ID() string

	// SearchSkills returns skill entries matching the query. Empty query
	// returns every available skill from this source.
	SearchSkills(ctx context.Context, query string) ([]RegistryEntry, error)

	// FindSkillByName returns an exact-match entry, or an error if the
	// source does not advertise a skill with the given name.
	FindSkillByName(ctx context.Context, name string) (*RegistryEntry, error)

	// FetchSkillContent returns the raw SKILL.md bytes for the entry.
	FetchSkillContent(ctx context.Context, entry *RegistryEntry) ([]byte, error)

	// FetchSkillFile returns a companion file relative to the entry's path.
	FetchSkillFile(ctx context.Context, entry *RegistryEntry, relPath string) ([]byte, error)
}

HubSource is one place TARS can fetch skill packages from. The built-in tars-hub implementation is TarsHubSource. External hubs (openclaw, hermes, anthropic) live in internal/skillhub/sources/.

type InstallResult added in v0.7.1

type InstallResult struct {
	RequiresPlugin string        `json:"requires_plugin,omitempty"` // non-empty if the skill depends on a plugin
	Sandbox        SandboxReport `json:"sandbox_report"`
}

InstallResult contains the sandboxed result of a hub package installation.

type InstalledDB

type InstalledDB struct {
	Skills  []InstalledSkill  `json:"skills"`
	Plugins []InstalledPlugin `json:"plugins,omitempty"`
	MCPs    []InstalledMCP    `json:"mcps,omitempty"`
}

InstalledDB tracks installed hub skills, plugins, and MCP packages.

type InstalledMCP added in v0.9.0

type InstalledMCP struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	Source   string `json:"source"`
	Dir      string `json:"dir"`
	Manifest string `json:"manifest"`
}

InstalledMCP tracks a managed MCP package that has been installed locally.

type InstalledPlugin added in v0.7.1

type InstalledPlugin struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Source  string `json:"source"`
	Dir     string `json:"dir"`
}

InstalledPlugin tracks a plugin that has been installed locally.

type InstalledSkill

type InstalledSkill struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Source  string `json:"source"`
	Dir     string `json:"dir"`
}

InstalledSkill tracks a skill that has been installed locally. Source is the HubSource ID the skill was fetched from (e.g. "tars-hub", "openclaw", "hermes", "anthropic"). Legacy rows with an empty Source are migrated to DefaultSourceID at load time.

type Installer

type Installer struct {
	WorkspaceDir string
	Registry     *Registry
	// Sources routes skill operations to the appropriate HubSource. The
	// built-in tars-hub source is registered by NewInstaller; external
	// hubs are added in later phases.
	Sources *SourceRegistry
}

Installer handles installing and managing hub skills.

func NewInstaller

func NewInstaller(workspaceDir string) *Installer

NewInstaller creates an installer for the given workspace. It registers the built-in tars-hub source by default so existing call sites keep working.

func (*Installer) Install

func (inst *Installer) Install(ctx context.Context, ref string) (*InstallResult, error)

Install downloads and installs a skill. The ref may be a bare name (any registered source is searched) or a "<source>:<name>" pair (e.g. "openclaw:foo").

func (*Installer) InstallMCP added in v0.9.0

func (inst *Installer) InstallMCP(ctx context.Context, name string) (*InstallResult, error)

InstallMCP downloads and installs an MCP package from the registry.

func (*Installer) InstallPack added in v0.31.113

func (inst *Installer) InstallPack(ctx context.Context, name string) (*PackInstallResult, error)

InstallPack installs every package in a pack using the standard sandboxed installers.

func (*Installer) InstallPlugin added in v0.7.1

func (inst *Installer) InstallPlugin(ctx context.Context, name string) (*InstallResult, error)

InstallPlugin downloads and installs a plugin from the registry.

func (*Installer) List

func (inst *Installer) List() ([]InstalledSkill, error)

List returns all installed hub skills.

func (*Installer) ListMCPs added in v0.9.0

func (inst *Installer) ListMCPs() ([]InstalledMCP, error)

ListMCPs returns all installed hub MCP packages.

func (*Installer) ListPlugins added in v0.7.1

func (inst *Installer) ListPlugins() ([]InstalledPlugin, error)

ListPlugins returns all installed hub plugins.

func (*Installer) PlanPackInstall added in v0.31.113

func (inst *Installer) PlanPackInstall(ctx context.Context, name string) (PackInstallPlan, error)

PlanPackInstall resolves a pack into the ordered packages that would be installed.

func (*Installer) Uninstall

func (inst *Installer) Uninstall(name string) error

Uninstall removes an installed skill.

func (*Installer) UninstallMCP added in v0.9.0

func (inst *Installer) UninstallMCP(name string) error

UninstallMCP removes an installed MCP package.

func (*Installer) UninstallPlugin added in v0.7.1

func (inst *Installer) UninstallPlugin(name string) error

UninstallPlugin removes an installed plugin.

func (*Installer) Update

func (inst *Installer) Update(ctx context.Context) (UpdateResult, error)

Update re-installs all installed skills with the latest version.

func (*Installer) UpdateMCPs added in v0.9.0

func (inst *Installer) UpdateMCPs(ctx context.Context) (UpdateResult, error)

UpdateMCPs re-installs all installed MCP packages with the latest version.

func (*Installer) UpdatePlugins added in v0.7.1

func (inst *Installer) UpdatePlugins(ctx context.Context) (UpdateResult, error)

UpdatePlugins re-installs all installed plugins with the latest version.

type MCPEntry added in v0.9.0

type MCPEntry struct {
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Version     string           `json:"version"`
	Author      string           `json:"author"`
	Tags        []string         `json:"tags"`
	Path        string           `json:"path"`
	Manifest    string           `json:"manifest,omitempty"`
	Files       []RegistryFile   `json:"files"`
	Quality     *QualityMetadata `json:"quality,omitempty"`
}

MCPEntry describes a managed MCP package in the registry.

type MCPManifest added in v0.9.0

type MCPManifest struct {
	SchemaVersion int              `json:"schema_version,omitempty"`
	Server        config.MCPServer `json:"server"`
}

type PackEntry added in v0.31.113

type PackEntry struct {
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Version     string           `json:"version"`
	Author      string           `json:"author"`
	Tags        []string         `json:"tags,omitempty"`
	Skills      []string         `json:"skills,omitempty"`
	Plugins     []string         `json:"plugins,omitempty"`
	MCPServers  []string         `json:"mcp_servers,omitempty"`
	Quality     *QualityMetadata `json:"quality,omitempty"`
}

PackEntry describes a domain pack that installs multiple hub packages.

type PackInstallItem added in v0.31.113

type PackInstallItem struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description,omitempty"`
	Action      string `json:"action"`
}

PackInstallItem captures one package in a pack install plan.

type PackInstallPlan added in v0.31.113

type PackInstallPlan struct {
	Pack  PackEntry         `json:"pack"`
	Items []PackInstallItem `json:"items"`
}

PackInstallPlan previews which hub packages a pack will install or update.

type PackInstallResult added in v0.31.113

type PackInstallResult struct {
	Plan           PackInstallPlan   `json:"plan"`
	Installed      []PackInstallItem `json:"installed,omitempty"`
	Skipped        []PackInstallItem `json:"skipped,omitempty"`
	SandboxReports []SandboxReport   `json:"sandbox_reports,omitempty"`
}

PackInstallResult reports the outcome of installing a pack.

type PluginEntry added in v0.7.1

type PluginEntry struct {
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Version     string           `json:"version"`
	Author      string           `json:"author"`
	Tags        []string         `json:"tags"`
	Path        string           `json:"path"`
	Files       RegistryFiles    `json:"files"`
	Quality     *QualityMetadata `json:"quality,omitempty"`
}

PluginEntry describes a plugin in the registry.

type QualityMetadata added in v0.31.112

type QualityMetadata struct {
	Score         int      `json:"score"`
	LastUpdated   string   `json:"last_updated,omitempty"`
	TestsPassing  *bool    `json:"tests_passing,omitempty"`
	RequiredTools []string `json:"required_tools,omitempty"`
	Permissions   []string `json:"permissions,omitempty"`
	CompanionCLI  *bool    `json:"companion_cli,omitempty"`
	InstallCount  int      `json:"install_count,omitempty"`
}

QualityMetadata carries install-time trust signals published by the hub registry.

type Registry

type Registry struct {
	RegistryURL  string
	SkillBaseURL string
	HTTPClient   *http.Client
}

Registry fetches and searches the remote skill registry.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a registry with default URLs.

func (*Registry) FetchFile

func (r *Registry) FetchFile(ctx context.Context, entry *RegistryEntry, relPath string) ([]byte, error)

FetchFile downloads a companion file relative to the skill's path.

func (*Registry) FetchIndex

func (r *Registry) FetchIndex(ctx context.Context) (*RegistryIndex, error)

FetchIndex downloads and parses registry.json.

func (*Registry) FetchMCPFile added in v0.9.0

func (r *Registry) FetchMCPFile(ctx context.Context, entry *MCPEntry, relPath string) ([]byte, error)

FetchMCPFile downloads a file relative to the MCP package path.

func (*Registry) FetchPluginFile added in v0.7.1

func (r *Registry) FetchPluginFile(ctx context.Context, entry *PluginEntry, relPath string) ([]byte, error)

FetchPluginFile downloads a file relative to the plugin's path.

func (*Registry) FetchSkillContent

func (r *Registry) FetchSkillContent(ctx context.Context, entry *RegistryEntry) ([]byte, error)

FetchSkillContent downloads the SKILL.md for the given entry.

func (*Registry) FindByName

func (r *Registry) FindByName(ctx context.Context, name string) (*RegistryEntry, error)

FindByName returns the exact-match entry.

func (*Registry) FindMCPByName added in v0.9.0

func (r *Registry) FindMCPByName(ctx context.Context, name string) (*MCPEntry, error)

FindMCPByName returns the exact-match MCP entry.

func (*Registry) FindPackByName added in v0.31.113

func (r *Registry) FindPackByName(ctx context.Context, name string) (*PackEntry, error)

FindPackByName returns the exact-match pack entry.

func (*Registry) FindPluginByName added in v0.7.1

func (r *Registry) FindPluginByName(ctx context.Context, name string) (*PluginEntry, error)

FindPluginByName returns the exact-match plugin entry.

func (*Registry) Search

func (r *Registry) Search(ctx context.Context, query string) ([]RegistryEntry, error)

Search returns entries matching the query (substring match on name, description, tags).

func (*Registry) SearchMCPServers added in v0.9.0

func (r *Registry) SearchMCPServers(ctx context.Context, query string) ([]MCPEntry, error)

SearchMCPServers returns MCP entries matching the query.

func (*Registry) SearchPacks added in v0.31.113

func (r *Registry) SearchPacks(ctx context.Context, query string) ([]PackEntry, error)

SearchPacks returns pack entries matching the query.

func (*Registry) SearchPlugins added in v0.7.1

func (r *Registry) SearchPlugins(ctx context.Context, query string) ([]PluginEntry, error)

SearchPlugins returns plugin entries matching the query.

type RegistryEntry

type RegistryEntry struct {
	Name           string           `json:"name"`
	Description    string           `json:"description"`
	Version        string           `json:"version"`
	Author         string           `json:"author"`
	Tags           []string         `json:"tags"`
	Path           string           `json:"path"`
	UserInvocable  bool             `json:"user_invocable"`
	RequiresPlugin string           `json:"requires_plugin,omitempty"`
	Files          RegistryFiles    `json:"files,omitempty"`
	Quality        *QualityMetadata `json:"quality,omitempty"`
}

RegistryEntry describes a single skill in the registry.

type RegistryFile added in v0.9.0

type RegistryFile struct {
	Path   string `json:"path"`
	SHA256 string `json:"sha256"`
}

RegistryFile describes a downloadable file and its checksum.

type RegistryFiles added in v0.15.0

type RegistryFiles []RegistryFile

RegistryFiles accepts both legacy path arrays and checksum-bearing file objects.

func (RegistryFiles) Paths added in v0.15.0

func (files RegistryFiles) Paths() []string

func (*RegistryFiles) UnmarshalJSON added in v0.15.0

func (files *RegistryFiles) UnmarshalJSON(data []byte) error

type RegistryIndex

type RegistryIndex struct {
	Version    int             `json:"version"`
	Skills     []RegistryEntry `json:"skills"`
	Plugins    []PluginEntry   `json:"plugins,omitempty"`
	MCPServers []MCPEntry      `json:"mcp_servers,omitempty"`
	Packs      []PackEntry     `json:"packs,omitempty"`
}

RegistryIndex is the top-level structure of registry.json.

type SandboxCheck added in v0.31.102

type SandboxCheck struct {
	Name       string             `json:"name"`
	Command    string             `json:"command,omitempty"`
	Status     SandboxCheckStatus `json:"status"`
	Output     string             `json:"output,omitempty"`
	Error      string             `json:"error,omitempty"`
	DurationMS int64              `json:"duration_ms,omitempty"`
}

SandboxCheck captures one validation step from a skill install sandbox.

type SandboxCheckStatus added in v0.31.102

type SandboxCheckStatus string
const (
	SandboxCheckPassed SandboxCheckStatus = "passed"
	SandboxCheckFailed SandboxCheckStatus = "failed"
)

type SandboxError added in v0.31.102

type SandboxError struct {
	Report SandboxReport
}

SandboxError is returned when a package passes download verification but fails sandbox checks.

func (*SandboxError) Error added in v0.31.102

func (e *SandboxError) Error() string

type SandboxReport added in v0.31.102

type SandboxReport struct {
	PackageType  string         `json:"package_type,omitempty"`
	PackageName  string         `json:"package_name,omitempty"`
	SkillName    string         `json:"skill_name"`
	WorkspaceDir string         `json:"workspace_dir,omitempty"`
	SkillDir     string         `json:"skill_dir,omitempty"`
	PluginDir    string         `json:"plugin_dir,omitempty"`
	MCPDir       string         `json:"mcp_dir,omitempty"`
	Passed       bool           `json:"passed"`
	Checks       []SandboxCheck `json:"checks"`
}

SandboxReport describes the isolated workspace validation performed before install.

type SourceRegistry added in v0.32.43

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

SourceRegistry holds the set of registered HubSources. It is safe for concurrent use.

func NewSourceRegistry added in v0.32.43

func NewSourceRegistry() *SourceRegistry

NewSourceRegistry returns an empty registry.

func (*SourceRegistry) Get added in v0.32.43

func (r *SourceRegistry) Get(id string) (HubSource, bool)

Get returns the source registered under id (case-insensitive).

func (*SourceRegistry) IDs added in v0.32.43

func (r *SourceRegistry) IDs() []string

IDs returns the registered source IDs in registration order.

func (*SourceRegistry) Len added in v0.32.43

func (r *SourceRegistry) Len() int

Len returns the number of registered sources.

func (*SourceRegistry) List added in v0.32.43

func (r *SourceRegistry) List() []HubSource

List returns all registered sources in registration order.

func (*SourceRegistry) Register added in v0.32.43

func (r *SourceRegistry) Register(src HubSource) error

Register adds a source. Returns an error if the source has an empty ID or if another source with the same canonical ID is already registered.

type TarsHubSource added in v0.32.43

type TarsHubSource struct {
	Registry *Registry
}

TarsHubSource adapts the built-in tars-skills registry to the HubSource interface. It is a thin wrapper around *Registry — preserving the existing fetch and search behaviour while letting the installer route skill operations through the same code path as future external hubs.

func NewTarsHubSource added in v0.32.43

func NewTarsHubSource() *TarsHubSource

NewTarsHubSource returns a TarsHubSource backed by a default Registry.

func (*TarsHubSource) FetchSkillContent added in v0.32.43

func (s *TarsHubSource) FetchSkillContent(ctx context.Context, entry *RegistryEntry) ([]byte, error)

FetchSkillContent returns the SKILL.md for the entry.

func (*TarsHubSource) FetchSkillFile added in v0.32.43

func (s *TarsHubSource) FetchSkillFile(ctx context.Context, entry *RegistryEntry, relPath string) ([]byte, error)

FetchSkillFile returns a companion file relative to the entry path.

func (*TarsHubSource) FindSkillByName added in v0.32.43

func (s *TarsHubSource) FindSkillByName(ctx context.Context, name string) (*RegistryEntry, error)

FindSkillByName delegates to the underlying Registry.

func (*TarsHubSource) ID added in v0.32.43

func (s *TarsHubSource) ID() string

ID returns the canonical built-in hub identifier.

func (*TarsHubSource) SearchSkills added in v0.32.43

func (s *TarsHubSource) SearchSkills(ctx context.Context, query string) ([]RegistryEntry, error)

SearchSkills delegates to the underlying Registry.

type UpdateDiagnostic added in v0.31.71

type UpdateDiagnostic struct {
	Name   string
	Reason string
	Err    error
}

UpdateDiagnostic captures a per-entry update outcome that is not a success.

func (UpdateDiagnostic) Detail added in v0.31.71

func (d UpdateDiagnostic) Detail() string

Detail returns the human-readable reason for a skipped or failed update.

type UpdateResult added in v0.31.71

type UpdateResult struct {
	Updated []string
	Skipped []UpdateDiagnostic
	Failed  []UpdateDiagnostic
}

UpdateResult reports updated, skipped, and failed entries from a hub update.

Jump to

Keyboard shortcuts

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