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

Function loadSkillCommandContext

internal/cli/skill_workspace.go:40–71  ·  view source on GitHub ↗
(ctx context.Context, deps commandDeps, agentName string)

Source from the content-addressed store, hash-verified

38}
39
40func loadSkillCommandContext(ctx context.Context, deps commandDeps, agentName string) (skillCommandContext, error) {
41 runtime, err := loadRuntimeContext(deps)
42 if err != nil {
43 return skillCommandContext{}, fmt.Errorf("cli: load skill runtime context: %w", err)
44 }
45
46 registry := skills.NewRegistry(skills.RegistryConfig{
47 BundledFS: skillbundled.FS(),
48 UserAgentsDir: runtime.HomePaths.AgentsDir,
49 UserSkillsDir: runtime.HomePaths.SkillsDir,
50 DisabledSkills: append([]string(nil), runtime.Config.Skills.DisabledSkills...),
51 })
52 if err := registry.LoadAll(ctx); err != nil {
53 return skillCommandContext{}, fmt.Errorf("cli: load skill registry: %w", err)
54 }
55
56 var skillList []*skills.Skill
57 if strings.TrimSpace(agentName) != "" {
58 skillList, err = registry.ForAgent(ctx, nil, agentName)
59 if err != nil {
60 return skillCommandContext{}, fmt.Errorf("cli: load agent skills: %w", err)
61 }
62 } else {
63 skillList = registry.List()
64 }
65
66 return skillCommandContext{
67 bundledFS: skillbundled.FS(),
68 registry: registry,
69 skills: skillList,
70 }, nil
71}
72
73func resolveCLIWorkspaceRoot(deps commandDeps) (string, error) {
74 workspace, err := currentWorkingDirectory(deps)

Callers 5

newSkillListCommandFunction · 0.85
runLocalSkillViewCommandFunction · 0.85
newSkillInfoCommandFunction · 0.85
newSkillWhereCommandFunction · 0.85

Calls 5

LoadAllMethod · 0.95
ForAgentMethod · 0.95
ListMethod · 0.95
loadRuntimeContextFunction · 0.85
appendFunction · 0.85

Tested by 1