catalog

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListFiles added in v0.1.1

func ListFiles(name string, limit int) ([]string, error)

ListFiles returns supporting files in a skill directory under the default Leros skills directory, excluding SKILL.md. Results are sorted. If limit > 0, at most limit files are returned.

func ParseSeedManifest added in v0.1.10

func ParseSeedManifest(data []byte) (entries map[string]string, warnings []string)

ParseSeedManifest parses the content of a .seed-manifest file into a map of skillName → hash. Each non-empty line must be "name:hash". Malformed lines are skipped and returned as a slice of warning strings for callers to log.

func ReadFile added in v0.1.1

func ReadFile(name string, relativePath string) ([]byte, error)

ReadFile reads a supporting file from a skill directory in the default Leros skills directory. It validates the path to prevent directory traversal.

func WalkSkillDirs added in v0.1.1

func WalkSkillDirs(root string, fn func(dirName string, skillMDPath string) error) error

WalkSkillDirs scans root for direct subdirectories containing a SKILL.md file. fn receives the directory name and full path to SKILL.md. Return filepath.SkipAll from fn to stop walking early.

Types

type Entry

type Entry struct {
	Manifest      Manifest
	Body          string
	Dir           string
	Path          string
	AbsoluteDir   string
	StoredSkillID string
}

Entry 表示一个已发现并解析出元数据和正文的 Skill 文档。

func Get added in v0.1.1

func Get(name string) (*Entry, error)

Get returns a full skill entry by name from the default Leros skills directory. It first tries the direct path <skillsDir>/<name>/SKILL.md (case-insensitive). If not found, it recursively walks the skills directory looking for SKILL.md files whose containing directory name matches name (case-insensitive). When a matching directory is found but the manifest name differs, the error describes the mismatch.

func (*Entry) Summary

func (e *Entry) Summary() Summary

Summary 返回适合提示词使用的 Skill 条目摘要。

type ErrSkillManifestMismatch added in v0.1.1

type ErrSkillManifestMismatch struct {
	RequestedName string
	ManifestName  string
	Path          string
}

ErrSkillManifestMismatch is returned when a skill directory is found but its manifest name does not match the requested name.

func (*ErrSkillManifestMismatch) Error added in v0.1.1

func (e *ErrSkillManifestMismatch) Error() string

type ErrSkillNotFound added in v0.1.1

type ErrSkillNotFound struct {
	Name    string
	Message string
}

ErrSkillNotFound is returned when a skill cannot be found in the catalog.

func (*ErrSkillNotFound) Error added in v0.1.1

func (e *ErrSkillNotFound) Error() string

type Manifest

type Manifest struct {
	Name        string           `yaml:"name"`
	Description string           `yaml:"description"`
	Version     string           `yaml:"version,omitempty"`
	Metadata    ManifestMetadata `yaml:"metadata,omitempty"`
}

Manifest 描述文件型 Skill 的元数据区域。

func ParseDocument

func ParseDocument(raw []byte) (*Manifest, string, error)

ParseDocument 解析带可选 YAML frontmatter 的 SKILL.md 文档。

func (*Manifest) Normalize

func (m *Manifest) Normalize(defaultName string)

Normalize 在解析 Skill 文档后补齐派生默认值。

type ManifestMetadata

type ManifestMetadata struct {
	Category      string   `yaml:"category,omitempty"`
	Tags          []string `yaml:"tags,omitempty"`
	Always        bool     `yaml:"always,omitempty"`
	RequiresTools []string `yaml:"requires_tools,omitempty"`
	Source        string   `yaml:"source,omitempty"`
	Trust         string   `yaml:"trust,omitempty"`
}

ManifestMetadata 存储 Skill 路由提示和元数据扩展。

type Summary

type Summary struct {
	SkillID       string
	Name          string
	Description   string
	Version       string
	Category      string
	Tags          []string
	Always        bool
	RequiresTools []string
	Source        string
	Trust         string
}

Summary 是注入运行时提示词的紧凑视图。

func List added in v0.1.1

func List() ([]Summary, error)

List returns skill summaries found in the default Leros skills directory, sorted by name. The skills directory is created if it does not exist.

Jump to

Keyboard shortcuts

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