(targetDir string, incoming discovery.Skill)
| 1087 | } |
| 1088 | |
| 1089 | func existingSkillPrompt(targetDir string, incoming discovery.Skill) string { |
| 1090 | skillFile := filepath.Join(targetDir, incoming.Name, "SKILL.md") |
| 1091 | data, err := os.ReadFile(skillFile) |
| 1092 | if err != nil { |
| 1093 | return fmt.Sprintf("Skill %q already exists. Overwrite?", incoming.DisplayName()) |
| 1094 | } |
| 1095 | |
| 1096 | result, err := frontmatter.Parse(string(data)) |
| 1097 | if err != nil || result.Metadata.Meta == nil { |
| 1098 | return fmt.Sprintf("Skill %q already exists. Overwrite?", incoming.DisplayName()) |
| 1099 | } |
| 1100 | |
| 1101 | repoInfo, _, err := source.ParseMetadataRepo(result.Metadata.Meta) |
| 1102 | ref, _ := result.Metadata.Meta["github-ref"].(string) |
| 1103 | if err != nil { |
| 1104 | return fmt.Sprintf("Skill %q already exists. Overwrite?", incoming.DisplayName()) |
| 1105 | } |
| 1106 | |
| 1107 | if repoInfo != nil { |
| 1108 | sourceName := ghrepo.FullName(repoInfo) |
| 1109 | if ref != "" { |
| 1110 | sourceName += "@" + ref |
| 1111 | } |
| 1112 | return fmt.Sprintf("Skill %q already installed from %s. Overwrite?", incoming.DisplayName(), sourceName) |
| 1113 | } |
| 1114 | |
| 1115 | return fmt.Sprintf("Skill %q already exists. Overwrite?", incoming.DisplayName()) |
| 1116 | } |
| 1117 | |
| 1118 | const installProgressLabel = "Downloading skill files" |
| 1119 |
no test coverage detected