MCPcopy Create free account
hub / github.com/diillson/chatcli / addSkillNodes

Method addSkillNodes

cli/knowledge_graph.go:138–160  ·  view source on GitHub ↗
(g *knowledge.Graph)

Source from the content-addressed store, hash-verified

136}
137
138func (cli *ChatCLI) addSkillNodes(g *knowledge.Graph) {
139 if cli.personaHandler == nil {
140 return
141 }
142 skills, err := cli.personaHandler.GetManager().ListSkills()
143 if err != nil {
144 return
145 }
146 for _, s := range skills {
147 if s == nil || s.Name == "" {
148 continue
149 }
150 id := "skill:" + s.Name
151 g.AddNode(knowledge.Node{ID: id, Kind: knowledge.KindSkill, Title: s.Name, Summary: s.Description, Weight: 1})
152 for _, tr := range s.Triggers {
153 slug := graphSlug(tr)
154 // Connect to a topic of the same slug if one exists (no-op otherwise).
155 g.AddEdge(id, "topic:"+slug, 1)
156 addTag(g, tr)
157 g.AddEdge(id, tagID(tr), 0.5)
158 }
159 }
160}
161
162var wikilinkRe = regexp.MustCompile(`\[\[([^\]]+)\]\]`)
163

Callers 1

buildKnowledgeGraphMethod · 0.95

Calls 7

graphSlugFunction · 0.85
addTagFunction · 0.85
tagIDFunction · 0.85
AddNodeMethod · 0.80
AddEdgeMethod · 0.80
ListSkillsMethod · 0.45
GetManagerMethod · 0.45

Tested by

no test coverage detected