MCPcopy Create free account
hub / github.com/compozy/agh / cleanFilesystemSkillRelativePath

Function cleanFilesystemSkillRelativePath

internal/cli/skill_workspace.go:494–506  ·  view source on GitHub ↗
(relativePath string)

Source from the content-addressed store, hash-verified

492}
493
494func cleanFilesystemSkillRelativePath(relativePath string) (string, error) {
495 cleaned := filepath.Clean(strings.TrimSpace(relativePath))
496 switch {
497 case cleaned == ".", cleaned == "":
498 return "", errors.New("skill file path is required")
499 case filepath.IsAbs(cleaned):
500 return "", errors.New("skill file path must be relative")
501 case cleaned == "..", strings.HasPrefix(cleaned, ".."+string(filepath.Separator)):
502 return "", errors.New("skill file path must stay within the skill directory")
503 default:
504 return cleaned, nil
505 }
506}
507
508func renderSkillXML(skill *skills.Skill, content string, resources []string) (string, error) {
509 if skill == nil {

Callers 1

readSkillResourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected