Class ToolsRemove

java.lang.Object
ai.wanaku.cli.main.commands.BaseCommand
ai.wanaku.cli.main.commands.tools.ToolsRemove
All Implemented Interfaces:
Callable<Integer>

public class ToolsRemove extends BaseCommand
CLI command for removing tool references from the Wanaku router.

This command supports two removal modes:

  • Single removal by name: Remove a specific tool using --name
    wanaku tools remove --name my-tool
  • Batch removal by label expression: Remove multiple tools matching a label filter
    wanaku tools remove --label-expression 'category=weather'
    wanaku tools remove -l 'environment!=production' -y

Label Expression Syntax:

The --label-expression option supports complex filtering using logical operators. For detailed syntax and examples, see the label expression manual page:

wanaku man label-expression

Safety Features:

  • Mutual exclusivity between --name and --label-expression
  • Preview table showing tools before batch removal
  • Confirmation prompt (can be bypassed with --assume-yes)
  • Clear feedback on removal results

Warning: Removal operations cannot be undone. Removed tools are unregistered from the tool manager and deleted from the repository.

See Also:
  • Field Details

    • host

      protected String host
  • Constructor Details

    • ToolsRemove

      public ToolsRemove()
  • Method Details

    • doCall

      public Integer doCall(org.jline.terminal.Terminal terminal, WanakuPrinter printer) throws Exception
      Executes the tool removal command.

      This method validates the command-line arguments and delegates to either removeByName(WanakuPrinter) or removeByLabelExpression(Terminal, WanakuPrinter) depending on which option was provided.

      The method enforces mutual exclusivity between --name and --label-expression options, ensuring exactly one removal method is specified.

      Specified by:
      doCall in class BaseCommand
      Parameters:
      terminal - the terminal for user interaction
      printer - the printer for displaying messages to the user
      Returns:
      BaseCommand.EXIT_OK if removal succeeded, BaseCommand.EXIT_ERROR if it failed or validation errors occurred
      Throws:
      Exception - if an unexpected error occurs during command execution