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

Function UninstallFromApp

internal/entities/apps.go:466–492  ·  view source on GitHub ↗

UninstallFromApp removes the entity's installation for app and reports whether anything was removed.

(entityName string, kind Kind, app string)

Source from the content-addressed store, hash-verified

464// UninstallFromApp removes the entity's installation for app and reports
465// whether anything was removed.
466func UninstallFromApp(entityName string, kind Kind, app string) (string, bool, error) {
467 apps := AppPathsFor(kind)
468 dest, ok := apps[app]
469 if !ok {
470 return "", false, fmt.Errorf("entities: app %s does not support %s", app, kind)
471 }
472 resolved := pathutil.Expand(dest)
473 switch kind {
474 case KindPrompt, KindInstruction:
475 if !pathutil.Exists(resolved) {
476 return resolved, false, nil
477 }
478 // Prompts/instructions are app-wide files; removing the file is opt-in only when
479 // the file matches the entity's content marker. We don't truncate
480 // arbitrary user data — instead report "found" if the file exists.
481 return resolved, false, nil
482 default:
483 dir := filepath.Join(resolved, entityName)
484 if !pathutil.Exists(dir) {
485 return dir, false, nil
486 }
487 if err := os.RemoveAll(dir); err != nil {
488 return dir, false, err
489 }
490 return dir, true, nil
491 }
492}
493
494func writeFile(path string, data []byte, mode os.FileMode) error {
495 if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {

Callers 3

uninstallOneFromAppFunction · 0.92
UninstallFromTargetsMethod · 0.92

Calls 3

ExpandFunction · 0.92
ExistsFunction · 0.92
AppPathsForFunction · 0.85

Tested by 1