MCPcopy Create free account
hub / github.com/cli/cli / scanAllAgents

Function scanAllAgents

pkg/cmd/skills/update/update.go:524–548  ·  view source on GitHub ↗

scanAllAgents walks every registered agent's skill directory (project + user scope) and collects installed skills. Shared install roots are scanned only once.

(gitRoot, homeDir string)

Source from the content-addressed store, hash-verified

522// scanAllAgents walks every registered agent's skill directory (project + user scope) and
523// collects installed skills. Shared install roots are scanned only once.
524func scanAllAgents(gitRoot, homeDir string) []installedSkill {
525 scannedDirs := make(map[string]bool)
526 var all []installedSkill
527
528 for i := range registry.Agents {
529 host := &registry.Agents[i]
530 for _, scope := range []registry.Scope{registry.ScopeProject, registry.ScopeUser} {
531 dir, err := host.InstallDir(scope, gitRoot, homeDir)
532 if err != nil {
533 continue
534 }
535 if scannedDirs[dir] {
536 continue
537 }
538 scannedDirs[dir] = true
539 skills, err := scanInstalledSkills(dir, host, scope)
540 if err != nil {
541 continue
542 }
543 all = append(all, skills...)
544 }
545 }
546
547 return all
548}
549
550// scanInstalledSkills reads all SKILL.md files in a skills directory and
551// extracts GitHub metadata from their frontmatter. It handles both flat

Callers 2

updateRunFunction · 0.85

Calls 2

InstallDirMethod · 0.80
scanInstalledSkillsFunction · 0.70