MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / InstallForTool

Function InstallForTool

internal/cli/agents.go:163–180  ·  view source on GitHub ↗

InstallForTool writes the skill content to the appropriate location for a tool.

(tool AgentTool, content []byte)

Source from the content-addressed store, hash-verified

161
162// InstallForTool writes the skill content to the appropriate location for a tool.
163func InstallForTool(tool AgentTool, content []byte) (string, error) {
164 cwd, err := os.Getwd()
165 if err != nil {
166 return "", err
167 }
168
169 skillDir := filepath.Join(cwd, tool.SkillDir)
170 if err := os.MkdirAll(skillDir, 0755); err != nil {
171 return "", fmt.Errorf("create directory %s: %w", skillDir, err)
172 }
173
174 destPath := filepath.Join(skillDir, tool.SkillFile)
175 if err := os.WriteFile(destPath, content, 0644); err != nil {
176 return "", fmt.Errorf("write skill file: %w", err)
177 }
178
179 return destPath, nil
180}
181
182// StripFrontmatter removes YAML frontmatter (between --- delimiters) from content.
183func StripFrontmatter(content []byte) []byte {

Callers 6

offerSkillInstallFunction · 0.92
ensureSkillsFunction · 0.92
installUpdateFunction · 0.92
installForToolFunction · 0.92
installAllFunction · 0.92
installInteractiveFunction · 0.92

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected