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