Documentation
¶
Index ¶
- Variables
- func AddLockEntry(dir string, entry LockEntry) error
- func ChecksumContent(content string) string
- func FetchSkillContent(ctx context.Context, source, skillName string) (string, error)
- func FormatInstalls(count int) string
- func InstallSkill(content, skillName, targetDir string) error
- func IsSkillInstalled(skillName, targetDir string) bool
- func RemoveLockEntry(dir string, skillName string) error
- func ResolveSkillsDir(projectLocal bool) string
- func UninstallSkill(skillName, targetDir string) error
- func WriteLock(dir string, lock *CatalogLock) error
- type CatalogLock
- type CatalogSkill
- type Client
- type LockEntry
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
var ErrSkillAlreadyInstalled = errors.New("skill already installed")
ErrSkillAlreadyInstalled is returned when a skill is already installed at the target location.
Functions ¶
func AddLockEntry ¶
AddLockEntry reads the lock, adds (or replaces) entry.Name, and writes it back.
func ChecksumContent ¶
ChecksumContent returns the SHA256 hex digest of the given content.
func FetchSkillContent ¶
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 ¶
FormatInstalls formats an install count into a human-readable string. Examples: 0 → "0 installs", 1500 → "1.5K installs", 3000000 → "3M installs".
func InstallSkill ¶
InstallSkill writes SKILL.md content to {targetDir}/{skillName}/SKILL.md. Returns ErrSkillAlreadyInstalled if the file already exists.
func IsSkillInstalled ¶
IsSkillInstalled reports whether {targetDir}/{skillName}/SKILL.md exists.
func RemoveLockEntry ¶
RemoveLockEntry reads the lock, removes the entry for skillName, and writes it back.
func ResolveSkillsDir ¶
ResolveSkillsDir returns the skills directory path. If projectLocal is true, returns ".pando/skills/" relative to the working directory. Otherwise returns ~/.pando/skills/.
func UninstallSkill ¶
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 ¶
NewClient creates a new catalog client. If baseURL is empty, it defaults to "https://skills.sh".
func (*Client) GetContent ¶
GetContent fetches the raw SKILL.md content for a skill identified by skillID. It fetches from {baseURL}/api/skills/{skillID}/content.
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.