MCPcopy Index your code
hub / github.com/53AI/53AIHub / buildSkillGitHubURL

Function buildSkillGitHubURL

api/controller/skill_library_admin.go:136–165  ·  view source on GitHub ↗
(skillInfo *model.SkillLibrary)

Source from the content-addressed store, hash-verified

134}
135
136func buildSkillGitHubURL(skillInfo *model.SkillLibrary) string {
137 if skillInfo == nil || skillInfo.SourceType != model.SkillSourceTypeGithub {
138 return ""
139 }
140
141 sourceRef := strings.TrimSpace(skillInfo.SourceRef)
142 if sourceRef == "" {
143 return ""
144 }
145
146 repoURL, refPart, ok := strings.Cut(sourceRef, "@")
147 if !ok {
148 return ""
149 }
150 repoURL = strings.TrimSpace(repoURL)
151 ref, skillPath, hasPath := strings.Cut(refPart, ":")
152 ref = strings.TrimSpace(ref)
153 if repoURL == "" || ref == "" {
154 return ""
155 }
156
157 if hasPath {
158 skillPath = strings.TrimSpace(skillPath)
159 if skillPath != "" {
160 return strings.TrimSuffix(repoURL, "/") + "/tree/" + ref + "/" + skillPath
161 }
162 }
163
164 return strings.TrimSuffix(repoURL, "/")
165}
166
167// AdminImportSkillLibrary godoc
168// @Summary 后台导入技能

Callers 1

AdminGetSkillLibraryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected