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

Function entityUninstallCommand

internal/cli/management.go:2097–2158  ·  view source on GitHub ↗

============================================================================ uninstall — remove from code agent(s) ============================================================================

(kind entities.Kind)

Source from the content-addressed store, hash-verified

2095// ============================================================================
2096
2097func entityUninstallCommand(kind entities.Kind) *cobra.Command {
2098 var (
2099 app string
2100 all bool
2101 )
2102 cmd := &cobra.Command{
2103 Use: "uninstall [NAME...]",
2104 Aliases: []string{"rm", "remove"},
2105 Short: "Uninstall " + string(kind) + "(s) from a code agent",
2106 Long: "Remove installed " + string(kind) + `(s) from a target code agent.
2107
2108When --app is omitted in an interactive terminal, you will be prompted
2109to select target agent(s).
2110
2111Supported agents: ` + strings.Join(entities.SupportedApps(kind), ", ") + `.
2112
2113Use --all to uninstall every installed item from the selected agent(s).`,
2114 Example: " cam " + string(kind) + " uninstall my-skill --app claude\n" +
2115 " cam " + string(kind) + " uninstall --all --app claude\n" +
2116 " cam " + string(kind) + " uninstall skill-a skill-b",
2117 Args: cobra.ArbitraryArgs,
2118 RunE: func(cmd *cobra.Command, args []string) error {
2119 out := cmd.OutOrStdout()
2120
2121 // Resolve target app(s).
2122 var apps []string
2123 if app != "" {
2124 apps = []string{app}
2125 } else if isInteractive(cmd.InOrStdin()) {
2126 picked, err := promptSelectApp(kind)
2127 if err != nil {
2128 return err
2129 }
2130 apps = picked
2131 } else {
2132 return fmt.Errorf("--app is required (one of: %s)", strings.Join(entities.SupportedApps(kind), ", "))
2133 }
2134
2135 if !all && len(args) == 0 {
2136 // Interactive: list what's installed and let user pick.
2137 if isInteractive(cmd.InOrStdin()) {
2138 return interactiveUninstall(kind, apps, out)
2139 }
2140 return fmt.Errorf("NAME is required (or use --all)")
2141 }
2142
2143 for _, a := range apps {
2144 if all {
2145 uninstallAllFromApp(kind, a, out)
2146 } else {
2147 for _, name := range args {
2148 uninstallOneFromApp(kind, a, name, out)
2149 }
2150 }
2151 }
2152 return nil
2153 },
2154 }

Callers 1

managementCommandMethod · 0.85

Calls 6

SupportedAppsFunction · 0.92
isInteractiveFunction · 0.85
promptSelectAppFunction · 0.85
interactiveUninstallFunction · 0.85
uninstallAllFromAppFunction · 0.85
uninstallOneFromAppFunction · 0.85

Tested by

no test coverage detected