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