MCPcopy Index your code
hub / github.com/cli/cli / existingSkillPrompt

Function existingSkillPrompt

pkg/cmd/skills/install/install.go:1079–1106  ·  view source on GitHub ↗
(targetDir string, incoming discovery.Skill)

Source from the content-addressed store, hash-verified

1077}
1078
1079func 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
1108const installProgressLabel = "Downloading skill files"
1109

Callers 1

checkOverwriteFunction · 0.85

Calls 5

ParseFunction · 0.92
ParseMetadataRepoFunction · 0.92
FullNameFunction · 0.92
JoinMethod · 0.80
DisplayNameMethod · 0.65

Tested by

no test coverage detected