skills

package
v0.20260526.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegistryLockTimeout    = 2 * time.Second
	DefaultRegistryLockRetryDelay = 50 * time.Millisecond
)
View Source
const (
	ScopeGlobal  = "global"
	ScopeProject = "project"
	ScopeLocal   = "local"
)

Variables

This section is empty.

Functions

func AgentsSkillsRoot

func AgentsSkillsRoot() (string, error)

func ApplyScope

func ApplyScope(r *Registry, scope string, projHex string, skillKey string, e SkillEntry)

func ConfirmInstall

func ConfirmInstall(in io.Reader, out io.Writer, meta *SkillsShMeta) (bool, error)

func DescriptionFromFrontMatter

func DescriptionFromFrontMatter(fm map[string]any) string

func DisplayNameFromFrontMatter

func DisplayNameFromFrontMatter(fm map[string]any, fallback string) string

func EnrichFrontMatterInteractive

func EnrichFrontMatterInteractive(in io.Reader, out io.Writer, fm map[string]any, displayOverride string) error

func EnsureSkillsAddGlobalYes

func EnsureSkillsAddGlobalYes(cmdLine string) string

func ForcedSkillUserMessagePayload added in v0.20260525.0

func ForcedSkillUserMessagePayload(entry SkillEntry, userText string) (string, error)

func InstalledSkillCount

func InstalledSkillCount(projHex, projRoot string) (int, error)

func InstalledSlashCommandNames added in v0.20260525.0

func InstalledSlashCommandNames(projHex, projRoot string) ([]string, error)

func IsRemoteMarkdownURL

func IsRemoteMarkdownURL(raw string) bool

func IsSkillMarkdownSource

func IsSkillMarkdownSource(raw string) bool

func ListInstalledSkills

func ListInstalledSkills(w io.Writer, projHex, projRoot string) error

func LocateSkillDir

func LocateSkillDir(repoRoot string, preferredSkill string) (relDir string, mdAbs string, err error)

func NormalizeMarkdownSourceURL

func NormalizeMarkdownSourceURL(raw string) (string, error)

func NormalizeRepoURL

func NormalizeRepoURL(raw string) (string, error)

func NormalizeSkillMarkdownSource

func NormalizeSkillMarkdownSource(raw string) (string, error)

func ParseAddArgs

func ParseAddArgs(parts []string) (*parsedAdd, error)

func ParseRemoveArgs

func ParseRemoveArgs(parts []string) (string, error)

func ParseSkillBytes

func ParseSkillBytes(b []byte) (fm map[string]any, body []byte, err error)

func ParseSkillFrontMatter

func ParseSkillFrontMatter(mdPath string) (map[string]any, error)

func ProjectEntries

func ProjectEntries(r *Registry, projHex string) map[string]SkillEntry

func RepoOwner

func RepoOwner(canonicalRepoURL string) string

func RequireNpm

func RequireNpm(ctx context.Context) (err error)

func ReservedSlashCommandNames

func ReservedSlashCommandNames() map[string]struct{}

func RunInstall

func RunInstall(opts InstallOpts) (err error)

func RunRemove

func RunRemove(opts RemoveOpts) (err error)

func SaveMirrorJSON

func SaveMirrorJSON(path string, m map[string]SkillEntry) error

func SaveRegistry

func SaveRegistry(path string, r *Registry) error

func SkillHelpCommand

func SkillHelpCommand(name string) string

func SkillInputPrefillText

func SkillInputPrefillText(entry SkillEntry) (string, error)

func SkillMarkdownBody

func SkillMarkdownBody(mdPath string) (string, error)

func SkillUserMessagePayload

func SkillUserMessagePayload(entry SkillEntry) (string, error)

func StableKeyHex

func StableKeyHex(canonicalRepoURL, skillRelPath string) string

func UniqueDisplayName

func UniqueDisplayName(r *Registry, canonical, baseDisplay, scope, projHex, skillKey string) string

func WithRegistryLock

func WithRegistryLock(lockPath, registryPath string, fn func(*Registry) error) error

func WriteInstalledSkillsSections

func WriteInstalledSkillsSections(w io.Writer, r *Registry, projHex, projRoot string) error

func WriteSkillMarkdown

func WriteSkillMarkdown(path string, fm map[string]any, body []byte) error

func WriteSkillsHelpSection

func WriteSkillsHelpSection(w io.Writer, cmdColMin int, projHex, projRoot string) error

Types

type InstallOpts

type InstallOpts struct {
	Ctx      context.Context
	Out      io.Writer
	In       io.Reader
	ProjHex  string
	ProjRoot string
	Args     []string
}

type Registry

type Registry struct {
	Global   map[string]SkillEntry            `json:"global"`
	Projects map[string]map[string]SkillEntry `json:"projects"`
}

func LoadRegistry

func LoadRegistry(path string) (*Registry, error)

func NewRegistry

func NewRegistry() *Registry

type RemoveOpts

type RemoveOpts struct {
	Out      io.Writer
	ProjHex  string
	ProjRoot string
	Args     []string
}

type SkillEntry

type SkillEntry struct {
	Name         string         `json:"name"`
	SourceRepo   string         `json:"source_repo"`
	SkillRelPath string         `json:"skill_rel_path"`
	ClonePath    string         `json:"clone_path"`
	SkillMdPath  string         `json:"skill_md_path"`
	FrontMatter  map[string]any `json:"front_matter,omitempty"`
	AuditSummary string         `json:"audit_summary,omitempty"`
	SkillSSHPage string         `json:"skillssh_page,omitempty"`
	InstalledAt  string         `json:"installed_at,omitempty"`
}

func LookupSkillBySlashCommand

func LookupSkillBySlashCommand(slashLower string, projHex, projRoot string) (*SkillEntry, error)

func PartitionInstalledSkills

func PartitionInstalledSkills(r *Registry, projHex, projRoot string) (local, project, global []SkillEntry)

func ResolveForcedSkillCommand added in v0.20260525.0

func ResolveForcedSkillCommand(raw, projHex, projRoot string) (*SkillEntry, string, string, error)

func ResolveSkillForLoad

func ResolveSkillForLoad(raw string, projHex, projRoot string) (*SkillEntry, string, error)

type SkillRefWithKey

type SkillRefWithKey struct {
	RegistryKey string
	Entry       SkillEntry
}

func OrderedSkillRefs

func OrderedSkillRefs(r *Registry, projHex, projRoot string) []SkillRefWithKey

type SkillSearchHit

type SkillSearchHit struct {
	Name        string  `json:"name"`
	Slash       string  `json:"slash"`
	Description string  `json:"description"`
	Score       float64 `json:"score"`
}

func SearchBestInstalledSkill

func SearchBestInstalledSkill(query string, projHex, projRoot string, minNormalized float64) (*SkillSearchHit, error)

type SkillSlashBinding

type SkillSlashBinding struct {
	Slash string
	Entry SkillEntry
}

func AssignSkillSlashCommands

func AssignSkillSlashCommands(refs []SkillRefWithKey) []SkillSlashBinding

type SkillsShMeta

type SkillsShMeta struct {
	PageURL        string
	RepoURL        string
	PreferredSkill string
	DisplayName    string
	AuditSummary   string
}

func FetchSkillsShMeta

func FetchSkillsShMeta(ctx context.Context, pageURL string) (*SkillsShMeta, error)

func (*SkillsShMeta) InstallShellCommand

func (m *SkillsShMeta) InstallShellCommand() string

Jump to

Keyboard shortcuts

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