FormatResolvedSkillIndex renders an XML block listing all source-aware skills. Aliases are the names the model should pass to the skill tools.
(resolved []skillspkg.ResolvedSkill)
| 54 | // FormatResolvedSkillIndex renders an XML block listing all source-aware |
| 55 | // skills. Aliases are the names the model should pass to the skill tools. |
| 56 | func FormatResolvedSkillIndex(resolved []skillspkg.ResolvedSkill) string { |
| 57 | if len(resolved) == 0 { |
| 58 | return "" |
| 59 | } |
| 60 | |
| 61 | entries := make([]skillIndexEntry, 0, len(resolved)) |
| 62 | hasQualifiedAlias := false |
| 63 | hasWorkspaceSkill := false |
| 64 | for _, s := range resolved { |
| 65 | entries = append(entries, skillIndexEntry{ |
| 66 | Alias: s.Alias, |
| 67 | Description: s.Description, |
| 68 | }) |
| 69 | if s.Source == skillspkg.SourceWorkspace { |
| 70 | hasWorkspaceSkill = true |
| 71 | } |
| 72 | if s.Alias == skillspkg.QualifiedAlias(s.Source, s.Name) { |
| 73 | hasQualifiedAlias = true |
| 74 | } |
| 75 | } |
| 76 | return renderSkillIndex(entries, skillIndexFormatOptions{ |
| 77 | includeQualifiedAliasInstruction: hasQualifiedAlias, |
| 78 | includeReadSkillFileInstruction: hasWorkspaceSkill, |
| 79 | }) |
| 80 | } |
| 81 | |
| 82 | type skillIndexEntry struct { |
| 83 | Alias string |