Skip to content

Commit 9de75c9

Browse files
majiayu000claude
andcommitted
feat: add Branch field and GitHubURL method to Skill
- Added Branch field to Skill struct for correct GitHub URLs - Added GitHubURL() method that generates direct link to SKILL.md - Uses branch from registry (main/master) instead of hardcoded value Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d80e2fc commit 9de75c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/registry/registry.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,29 @@ type Skill struct {
4040
Install string `json:"install"`
4141
Repo string `json:"repo"`
4242
Path string `json:"path"`
43+
Branch string `json:"branch"`
4344
Category string `json:"category"`
4445
Tags []string `json:"tags"`
4546
Source string `json:"source"`
4647
Stars int `json:"stars"`
4748
Featured bool `json:"featured"`
4849
}
4950

51+
// GitHubURL returns the GitHub URL for viewing this skill's SKILL.md
52+
func (s *Skill) GitHubURL() string {
53+
if s.Repo == "" {
54+
return ""
55+
}
56+
branch := s.Branch
57+
if branch == "" {
58+
branch = "main"
59+
}
60+
if s.Path != "" {
61+
return fmt.Sprintf("https://github.com/%s/blob/%s/%s/SKILL.md", s.Repo, branch, s.Path)
62+
}
63+
return fmt.Sprintf("https://github.com/%s/blob/%s/SKILL.md", s.Repo, branch)
64+
}
65+
5066
// Category represents a category index
5167
type Category struct {
5268
Category string `json:"category"`

0 commit comments

Comments
 (0)