MCPcopy Create free account
hub / github.com/github/gh-aw / detectNetworkFromRepo

Function detectNetworkFromRepo

pkg/cli/interactive.go:825–851  ·  view source on GitHub ↗

detectNetworkFromRepo scans the current working directory for ecosystem indicator files and returns a deduplicated, sorted list of network bucket names to add.

()

Source from the content-addressed store, hash-verified

823// detectNetworkFromRepo scans the current working directory for ecosystem indicator
824// files and returns a deduplicated, sorted list of network bucket names to add.
825func detectNetworkFromRepo() []string {
826 cwd, err := os.Getwd()
827 if err != nil {
828 return nil
829 }
830
831 seen := map[string]struct {
832 }{}
833 for _, m := range repoLanguageMarkers {
834 var found bool
835 if strings.ContainsAny(m.file, "*?[") {
836 // Glob pattern
837 matches, err := filepath.Glob(filepath.Join(cwd, m.file))
838 found = err == nil && len(matches) > 0
839 } else {
840 _, err := os.Stat(filepath.Join(cwd, m.file))
841 found = err == nil
842 }
843 if found && !setutil.Contains(seen, m.bucket) {
844 seen[m.bucket] = struct {
845 }{}
846 }
847 }
848
849 buckets := sliceutil.SortedKeys(seen)
850 return buckets
851}

Callers 3

Calls 2

ContainsFunction · 0.92
SortedKeysFunction · 0.92

Tested by 1