MCPcopy Create free account
hub / github.com/astercloud/aster / Discover

Method Discover

pkg/skills/loader.go:220–239  ·  view source on GitHub ↗

Discover 发现所有可用技能

(ctx context.Context)

Source from the content-addressed store, hash-verified

218
219// Discover 发现所有可用技能
220func (sl *SkillLoader) Discover(ctx context.Context) ([]string, error) {
221 // 递归搜索所有 SKILL.md 文件
222 pattern := "**/SKILL.md"
223 files, err := sl.fs.Glob(ctx, pattern, &sandbox.GlobOptions{
224 CWD: sl.baseDir,
225 Absolute: false,
226 })
227 if err != nil {
228 return nil, fmt.Errorf("glob skills: %w", err)
229 }
230
231 skills := make([]string, 0, len(files))
232 for _, file := range files {
233 // 提取技能路径(去掉 /SKILL.md)
234 skillPath := strings.TrimSuffix(file, "/SKILL.md")
235 skills = append(skills, skillPath)
236 }
237
238 return skills, nil
239}

Callers 1

ListMethod · 0.80

Calls 1

GlobMethod · 0.65

Tested by

no test coverage detected