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

Function cleanBundledSkillRelativePath

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

Source from the content-addressed store, hash-verified

478}
479
480func cleanBundledSkillRelativePath(relativePath string) (string, error) {
481 cleaned := path.Clean(strings.TrimSpace(strings.ReplaceAll(relativePath, "\\", "/")))
482 switch {
483 case cleaned == ".", cleaned == "":
484 return "", errors.New("skill file path is required")
485 case strings.HasPrefix(cleaned, "/"):
486 return "", errors.New("skill file path must be relative")
487 case cleaned == "..", strings.HasPrefix(cleaned, "../"):
488 return "", errors.New("skill file path must stay within the skill directory")
489 default:
490 return cleaned, nil
491 }
492}
493
494func cleanFilesystemSkillRelativePath(relativePath string) (string, error) {
495 cleaned := filepath.Clean(strings.TrimSpace(relativePath))

Callers 1

readSkillResourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected