Documentation
¶
Index ¶
- func ListFiles(name string, limit int) ([]string, error)
- func ParseSeedManifest(data []byte) (entries map[string]string, warnings []string)
- func ReadFile(name string, relativePath string) ([]byte, error)
- func WalkSkillDirs(root string, fn func(dirName string, skillMDPath string) error) error
- type Entry
- type ErrSkillManifestMismatch
- type ErrSkillNotFound
- type Manifest
- type ManifestMetadata
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListFiles ¶ added in v0.1.1
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
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
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
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
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.
type ErrSkillManifestMismatch ¶ added in v0.1.1
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
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 ¶
ParseDocument 解析带可选 YAML frontmatter 的 SKILL.md 文档。
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 路由提示和元数据扩展。