Documentation
¶
Overview ¶
Package skillhub provides marketplace clients and safe local installation for skills.
Index ¶
- Variables
- type Category
- type ClawHubClient
- func (c *ClawHubClient) Categories(context.Context) ([]Category, error)
- func (c *ClawHubClient) Detail(ctx context.Context, id SkillID) (SkillDetail, error)
- func (c *ClawHubClient) Download(ctx context.Context, id SkillID, version string) (io.ReadCloser, DownloadMeta, error)
- func (c *ClawHubClient) DownloadSources(id SkillID, version string) []DownloadSource
- func (c *ClawHubClient) Evaluation(context.Context, SkillID) (any, error)
- func (c *ClawHubClient) Files(ctx context.Context, id SkillID, version string) ([]SkillFile, error)
- func (c *ClawHubClient) Market() MarketInfo
- func (c *ClawHubClient) Search(ctx context.Context, q SearchQuery) (SearchPage, error)
- func (c *ClawHubClient) UserSkills(ctx context.Context, handle string, q UserSkillsQuery) (SearchPage, error)
- type DownloadMeta
- type DownloadSource
- type InstallMetadata
- type InstallRequest
- type InstallResult
- type InstalledState
- type LocalIndex
- type Market
- type MarketCapabilities
- type MarketClient
- type MarketInfo
- type SearchPage
- type SearchQuery
- type Service
- func (s *Service) Categories(ctx context.Context, market Market) ([]Category, error)
- func (s *Service) Detail(ctx context.Context, market Market, id string) (SkillDetail, error)
- func (s *Service) Install(ctx context.Context, request InstallRequest) (InstallResult, error)
- func (s *Service) Markets() []MarketInfo
- func (s *Service) Official(ctx context.Context, query UserSkillsQuery) (SearchPage, error)
- func (s *Service) Search(ctx context.Context, market Market, query SearchQuery) (SearchPage, error)
- type SkillDetail
- type SkillFile
- type SkillHubClient
- func (c *SkillHubClient) Categories(ctx context.Context) ([]Category, error)
- func (c *SkillHubClient) Detail(ctx context.Context, id SkillID) (SkillDetail, error)
- func (c *SkillHubClient) Download(ctx context.Context, id SkillID, version string) (io.ReadCloser, DownloadMeta, error)
- func (c *SkillHubClient) DownloadSources(id SkillID, version string) []DownloadSource
- func (c *SkillHubClient) Evaluation(ctx context.Context, id SkillID) (any, error)
- func (c *SkillHubClient) Files(ctx context.Context, id SkillID, version string) ([]SkillFile, error)
- func (c *SkillHubClient) Market() MarketInfo
- func (c *SkillHubClient) Search(ctx context.Context, q SearchQuery) (SearchPage, error)
- func (c *SkillHubClient) UserSkills(ctx context.Context, handle string, q UserSkillsQuery) (SearchPage, error)
- type SkillID
- type SkillSummary
- type UserSkillsQuery
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLocalSkillExists = errors.New("skill directory already exists and is not managed by SkillHub") ErrInvalidArchive = errors.New("skill archive is invalid") )
Functions ¶
This section is empty.
Types ¶
type ClawHubClient ¶
type ClawHubClient struct {
// contains filtered or unexported fields
}
func NewClawHubClient ¶
func NewClawHubClient(baseURL string, client *http.Client) *ClawHubClient
func (*ClawHubClient) Categories ¶
func (c *ClawHubClient) Categories(context.Context) ([]Category, error)
func (*ClawHubClient) Detail ¶
func (c *ClawHubClient) Detail(ctx context.Context, id SkillID) (SkillDetail, error)
func (*ClawHubClient) Download ¶
func (c *ClawHubClient) Download(ctx context.Context, id SkillID, version string) (io.ReadCloser, DownloadMeta, error)
func (*ClawHubClient) DownloadSources ¶
func (c *ClawHubClient) DownloadSources(id SkillID, version string) []DownloadSource
func (*ClawHubClient) Evaluation ¶
func (*ClawHubClient) Market ¶
func (c *ClawHubClient) Market() MarketInfo
func (*ClawHubClient) Search ¶
func (c *ClawHubClient) Search(ctx context.Context, q SearchQuery) (SearchPage, error)
func (*ClawHubClient) UserSkills ¶
func (c *ClawHubClient) UserSkills(ctx context.Context, handle string, q UserSkillsQuery) (SearchPage, error)
UserSkills is not available from the public ClawHub API. Search supports author filtering.
type DownloadMeta ¶
type DownloadSource ¶
type InstallMetadata ¶
type InstallRequest ¶
type InstallResult ¶
type InstallResult struct {
Name string `json:"name"`
Market Market `json:"market"`
Version string `json:"version"`
Scope string `json:"scope"`
Dir string `json:"dir"`
Installed bool `json:"installed"`
AlreadyInstalled bool `json:"alreadyInstalled,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
func Install ¶
func Install(ctx context.Context, client MarketClient, request InstallRequest) (InstallResult, error)
type InstalledState ¶
type LocalIndex ¶
type LocalIndex struct {
// contains filtered or unexported fields
}
func NewLocalIndex ¶
func NewLocalIndex(globalDir string, projectDirs []string) (*LocalIndex, error)
func (*LocalIndex) Apply ¶
func (i *LocalIndex) Apply(items []SkillSummary)
func (*LocalIndex) List ¶
func (i *LocalIndex) List() []InstalledState
func (*LocalIndex) State ¶
func (i *LocalIndex) State(market Market, id string) *InstalledState
type MarketCapabilities ¶
type MarketClient ¶
type MarketClient interface {
Market() MarketInfo
Search(context.Context, SearchQuery) (SearchPage, error)
UserSkills(context.Context, string, UserSkillsQuery) (SearchPage, error)
Detail(context.Context, SkillID) (SkillDetail, error)
Files(context.Context, SkillID, string) ([]SkillFile, error)
Evaluation(context.Context, SkillID) (any, error)
DownloadSources(SkillID, string) []DownloadSource
Download(context.Context, SkillID, string) (io.ReadCloser, DownloadMeta, error)
Categories(context.Context) ([]Category, error)
}
type MarketInfo ¶
type MarketInfo struct {
ID Market `json:"id"`
Name string `json:"name"`
SiteURL string `json:"siteUrl"`
Capabilities MarketCapabilities `json:"capabilities"`
}
type SearchPage ¶
type SearchPage struct {
Items []SkillSummary `json:"items"`
Total int64 `json:"total,omitempty"`
Page int `json:"page,omitempty"`
PageSize int `json:"pageSize,omitempty"`
NextCursor string `json:"nextCursor,omitempty"`
}
type SearchQuery ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(globalDir string, projectDirs []string, officialHandles []string, clients ...MarketClient) *Service
func NewServiceForWorkDir ¶
func NewServiceForWorkDir(globalDir, workDir string, officialHandles []string, clients ...MarketClient) *Service
func (*Service) Categories ¶
func (*Service) Install ¶
func (s *Service) Install(ctx context.Context, request InstallRequest) (InstallResult, error)
func (*Service) Markets ¶
func (s *Service) Markets() []MarketInfo
func (*Service) Official ¶
func (s *Service) Official(ctx context.Context, query UserSkillsQuery) (SearchPage, error)
func (*Service) Search ¶
func (s *Service) Search(ctx context.Context, market Market, query SearchQuery) (SearchPage, error)
type SkillDetail ¶
type SkillDetail struct {
SkillSummary
Files []SkillFile `json:"files,omitempty"`
DownloadSources []DownloadSource `json:"downloadSources,omitempty"`
Readme string `json:"readme,omitempty"`
SecurityReports any `json:"securityReports,omitempty"`
Evaluation any `json:"evaluation,omitempty"`
}
type SkillHubClient ¶
type SkillHubClient struct {
// contains filtered or unexported fields
}
func NewSkillHubClient ¶
func NewSkillHubClient(baseURL string, client *http.Client) *SkillHubClient
func (*SkillHubClient) Categories ¶
func (c *SkillHubClient) Categories(ctx context.Context) ([]Category, error)
func (*SkillHubClient) Detail ¶
func (c *SkillHubClient) Detail(ctx context.Context, id SkillID) (SkillDetail, error)
func (*SkillHubClient) Download ¶
func (c *SkillHubClient) Download(ctx context.Context, id SkillID, version string) (io.ReadCloser, DownloadMeta, error)
func (*SkillHubClient) DownloadSources ¶
func (c *SkillHubClient) DownloadSources(id SkillID, version string) []DownloadSource
func (*SkillHubClient) Evaluation ¶
func (*SkillHubClient) Market ¶
func (c *SkillHubClient) Market() MarketInfo
func (*SkillHubClient) Search ¶
func (c *SkillHubClient) Search(ctx context.Context, q SearchQuery) (SearchPage, error)
func (*SkillHubClient) UserSkills ¶
func (c *SkillHubClient) UserSkills(ctx context.Context, handle string, q UserSkillsQuery) (SearchPage, error)
type SkillSummary ¶
type SkillSummary struct {
Market Market `json:"market"`
ID string `json:"id"`
Slug string `json:"slug"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Version string `json:"version"`
Author string `json:"author"`
Category string `json:"category"`
Tags []string `json:"tags,omitempty"`
IconURL string `json:"iconUrl,omitempty"`
Homepage string `json:"homepage,omitempty"`
SourceURL string `json:"sourceUrl,omitempty"`
Source string `json:"source,omitempty"`
PublisherName string `json:"publisherName,omitempty"`
CertifiedName string `json:"certifiedName,omitempty"`
PublisherVerified bool `json:"publisherVerified,omitempty"`
Downloads int64 `json:"downloads,omitempty"`
Installs int64 `json:"installs,omitempty"`
Stars int64 `json:"stars,omitempty"`
Score float64 `json:"score,omitempty"`
Verified bool `json:"verified,omitempty"`
Suspicious bool `json:"suspicious,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
Installed *InstalledState `json:"installed,omitempty"`
}
type UserSkillsQuery ¶
Click to show internal directories.
Click to hide internal directories.