catalog

package
v0.262.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkillAlreadyInstalled = errors.New("skill already installed")

ErrSkillAlreadyInstalled is returned when a skill is already installed at the target location.

Functions

func AddLockEntry

func AddLockEntry(dir string, entry LockEntry) error

AddLockEntry reads the lock, adds (or replaces) entry.Name, and writes it back.

func ChecksumContent

func ChecksumContent(content string) string

ChecksumContent returns the SHA256 hex digest of the given content.

func FetchSkillContent

func FetchSkillContent(ctx context.Context, source, skillName string) (string, error)

FetchSkillContent attempts to fetch SKILL.md content from a GitHub repository. source must be in "owner/repo" format. skillName is the skill identifier. It tries multiple URL patterns and returns the first successful response.

func FormatInstalls

func FormatInstalls(count int) string

FormatInstalls formats an install count into a human-readable string. Examples: 0 → "0 installs", 1500 → "1.5K installs", 3000000 → "3M installs".

func InstallSkill

func InstallSkill(content, skillName, targetDir string) error

InstallSkill writes SKILL.md content to {targetDir}/{skillName}/SKILL.md. Returns ErrSkillAlreadyInstalled if the file already exists.

func IsSkillInstalled

func IsSkillInstalled(skillName, targetDir string) bool

IsSkillInstalled reports whether {targetDir}/{skillName}/SKILL.md exists.

func RemoveLockEntry

func RemoveLockEntry(dir string, skillName string) error

RemoveLockEntry reads the lock, removes the entry for skillName, and writes it back.

func ResolveSkillsDir

func ResolveSkillsDir(projectLocal bool) string

ResolveSkillsDir returns the skills directory path. If projectLocal is true, returns ".pando/skills/" relative to the working directory. Otherwise returns ~/.pando/skills/.

func UninstallSkill

func UninstallSkill(skillName, targetDir string) error

UninstallSkill removes the {targetDir}/{skillName}/ directory and all its contents.

func WriteLock

func WriteLock(dir string, lock *CatalogLock) error

WriteLock serialises lock to {dir}/catalog-lock.json, creating parent directories as needed.

Types

type CatalogLock

type CatalogLock struct {
	Version string               `json:"version"`
	Skills  map[string]LockEntry `json:"skills"`
}

CatalogLock represents the catalog-lock.json file.

func ReadLock

func ReadLock(dir string) (*CatalogLock, error)

ReadLock reads {dir}/catalog-lock.json. If the file does not exist, it returns an empty lock with version "1".

type CatalogSkill

type CatalogSkill struct {
	ID       string `json:"id"`
	SkillID  string `json:"skillId"`
	Name     string `json:"name"`
	Installs int    `json:"installs"`
	Source   string `json:"source"`
}

CatalogSkill represents a skill entry from the skills.sh catalog.

type Client

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

Client is an HTTP client for the skills.sh catalog API.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new catalog client. If baseURL is empty, it defaults to "https://skills.sh".

func (*Client) GetContent

func (c *Client) GetContent(ctx context.Context, skillID string) (string, error)

GetContent fetches the raw SKILL.md content for a skill identified by skillID. It fetches from {baseURL}/api/skills/{skillID}/content.

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string, limit int) (*SearchResult, error)

Search queries the skills.sh catalog for skills matching the given query. If limit is <= 0, it defaults to 10.

type LockEntry

type LockEntry struct {
	Name        string    `json:"name"`
	Source      string    `json:"source"`
	SkillID     string    `json:"skillId"`
	Scope       string    `json:"scope"`
	InstalledAt time.Time `json:"installedAt"`
	Checksum    string    `json:"checksum"`
}

LockEntry holds metadata for a single installed catalog skill.

type SearchResult

type SearchResult struct {
	Query      string         `json:"query"`
	SearchType string         `json:"searchType"`
	Skills     []CatalogSkill `json:"skills"`
	Count      int            `json:"count"`
	DurationMs int            `json:"duration_ms"`
}

SearchResult is the response from the skills.sh search API.

Jump to

Keyboard shortcuts

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