MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / normalizeLocalSkillInstallRoot

Function normalizeLocalSkillInstallRoot

agent/app/service/agents_skills.go:380–399  ·  view source on GitHub ↗
(extractRoot, installRoot, skillName string)

Source from the content-addressed store, hash-verified

378}
379
380func normalizeLocalSkillInstallRoot(extractRoot, installRoot, skillName string) (string, string, error) {
381 entries, err := os.ReadDir(extractRoot)
382 if err != nil {
383 return "", "", err
384 }
385 if len(entries) == 0 {
386 return "", "", fmt.Errorf("skill package is empty")
387 }
388 if len(entries) == 1 && entries[0].IsDir() {
389 return extractRoot, entries[0].Name(), nil
390 }
391 skillRoot := filepath.Join(installRoot, skillName)
392 if err := os.MkdirAll(skillRoot, 0755); err != nil {
393 return "", "", err
394 }
395 if err := copyLocalDirContents(extractRoot, skillRoot); err != nil {
396 return "", "", err
397 }
398 return installRoot, skillName, nil
399}
400
401func registerOpenclawLocalSkill(containerName, configPath, skillName string) error {
402 conf, err := readOpenclawConfig(configPath)

Callers 1

installLocalSkillPackageFunction · 0.85

Calls 5

copyLocalDirContentsFunction · 0.85
ReadDirMethod · 0.80
IsDirMethod · 0.80
MkdirAllMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected