MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / fetchAllRepos

Function fetchAllRepos

internal/cli/management.go:1233–1267  ·  view source on GitHub ↗
(cmd *cobra.Command, kind entities.Kind, out io.Writer)

Source from the content-addressed store, hash-verified

1231}
1232
1233func fetchAllRepos(cmd *cobra.Command, kind entities.Kind, out io.Writer) error {
1234 repos, err := repoconfig.LoadEnabled(kind)
1235 if err != nil {
1236 return err
1237 }
1238 if len(repos) == 0 {
1239 fmt.Fprintf(out, "No enabled %s repositories configured\n", kind)
1240 return nil
1241 }
1242
1243 totalAdded := 0
1244 for key, r := range repos {
1245 rOwner := r.EffectiveOwner()
1246 name := r.EffectiveName()
1247 branch := r.EffectiveBranch()
1248 subPath := r.SubPath(kind)
1249
1250 if rOwner == "" || name == "" {
1251 fmt.Fprintf(out, " Skipping %s: missing owner or repo name\n", key)
1252 continue
1253 }
1254
1255 fmt.Fprintf(out, " Fetching from %s/%s@%s ...\n", rOwner, name, branch)
1256 added, err := fetchSingleRepoCount(kind, rOwner, name, branch, subPath)
1257 if err != nil {
1258 fmt.Fprintf(out, " Error: %v\n", err)
1259 continue
1260 }
1261 fmt.Fprintf(out, " Found %d %s(s)\n", added, kind)
1262 totalAdded += added
1263 }
1264
1265 fmt.Fprintf(out, "\nTotal: fetched %d %s(s) from %d repos\n", totalAdded, kind, len(repos))
1266 return nil
1267}
1268
1269func fetchSingleRepo(kind entities.Kind, owner, repo, branch, path string, out io.Writer) error {
1270 added, err := fetchSingleRepoCount(kind, owner, repo, branch, path)

Callers 1

entityUpdateCommandFunction · 0.85

Calls 6

LoadEnabledFunction · 0.92
fetchSingleRepoCountFunction · 0.85
EffectiveOwnerMethod · 0.80
EffectiveNameMethod · 0.80
EffectiveBranchMethod · 0.80
SubPathMethod · 0.80

Tested by

no test coverage detected