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

Method UninstallFromTargets

internal/metadata/refresh.go:413–443  ·  view source on GitHub ↗

UninstallFromTargets removes an entity from the specified apps and updates the metadata store's installed status.

(ctx context.Context, kind, installKey string, targetApps []string)

Source from the content-addressed store, hash-verified

411// UninstallFromTargets removes an entity from the specified apps and updates
412// the metadata store's installed status.
413func (svc *Service) UninstallFromTargets(ctx context.Context, kind, installKey string, targetApps []string) error {
414 if len(targetApps) == 0 {
415 return fmt.Errorf("metadata: no target agents specified")
416 }
417 item, err := svc.store.GetItem(ctx, kind, installKey)
418 if err != nil {
419 return fmt.Errorf("metadata: item not found: %w", err)
420 }
421
422 entityKind := entities.Kind(item.Kind)
423 entityName := item.Name
424
425 var removed []string
426 var lastErr error
427 for _, app := range targetApps {
428 if _, _, err := entities.UninstallFromApp(entityName, entityKind, app); err != nil {
429 lastErr = fmt.Errorf("metadata: uninstall from %s: %w", app, err)
430 continue
431 }
432 removed = append(removed, app)
433 }
434 if len(removed) == 0 {
435 return lastErr
436 }
437 for _, app := range removed {
438 if err := svc.store.MarkUninstalled(ctx, kind, installKey, app); err != nil {
439 lastErr = err
440 }
441 }
442 return lastErr
443}
444
445// fetchResourceContent downloads the resource's source repo and reads its
446// manifest content. Failures return an empty string so install still creates the

Callers 1

Calls 4

KindTypeAlias · 0.92
UninstallFromAppFunction · 0.92
GetItemMethod · 0.80
MarkUninstalledMethod · 0.80

Tested by

no test coverage detected