fix(skills): prioritize DisplayName/Name over InstallName match
Use a two-pass search so exact DisplayName and Name matches are preferred over InstallName. This avoids incorrectly selecting a plugins-convention skill via InstallName when a standard namespaced skill with a matching DisplayName exists later in the sorted slice. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
1160943af3
commit
6fcc9c24df
1 changed files with 8 additions and 1 deletions
|
|
@ -391,7 +391,14 @@ func isMarkdownFile(filePath string) bool {
|
|||
func selectSkill(opts *PreviewOptions, skills []discovery.Skill) (discovery.Skill, error) {
|
||||
if opts.SkillName != "" {
|
||||
for _, s := range skills {
|
||||
if s.DisplayName() == opts.SkillName || s.Name == opts.SkillName || s.InstallName() == opts.SkillName {
|
||||
if s.DisplayName() == opts.SkillName || s.Name == opts.SkillName {
|
||||
return s, nil
|
||||
}
|
||||
}
|
||||
// Fall back to InstallName so that namespaced identifiers produced
|
||||
// by the post-install hint (e.g. "namespace/skill") are accepted.
|
||||
for _, s := range skills {
|
||||
if s.InstallName() == opts.SkillName {
|
||||
return s, nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue