DiscoverCatalogResources reads a generated markdown catalog file from a repo and turns each catalog table row into a resource. Generated awesome repos use these tables instead of concrete SKILL.md/plugin.json manifests.
(root, catalogFile string, kind entities.Kind)
| 13 | // and turns each catalog table row into a resource. Generated awesome repos use |
| 14 | // these tables instead of concrete SKILL.md/plugin.json manifests. |
| 15 | func DiscoverCatalogResources(root, catalogFile string, kind entities.Kind) []DiscoveredResource { |
| 16 | catalogFile = strings.TrimSpace(strings.Trim(catalogFile, "/")) |
| 17 | if catalogFile == "" { |
| 18 | return nil |
| 19 | } |
| 20 | path := filepath.Join(root, filepath.FromSlash(catalogFile)) |
| 21 | data, err := os.ReadFile(path) |
| 22 | if err != nil { |
| 23 | return nil |
| 24 | } |
| 25 | return parseCatalogMarkdown(string(data), filepath.ToSlash(catalogFile), kind) |
| 26 | } |
| 27 | |
| 28 | func inferCatalogFile(root string, kind entities.Kind) string { |
| 29 | for _, candidate := range catalogCandidates(kind) { |