Class CapabilitiesList

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

public class CapabilitiesList extends BaseCommand
Command-line interface for listing all service capabilities in the Wanaku system.

This command provides functionality to discover and display both management tools and resource providers available in the system, along with their current status and activity information. It combines data from multiple API endpoints to present a unified view of system capabilities in a tabular format.

The command supports the following functionality:

  • Fetches management tools and resource providers from the API
  • Retrieves activity status for each service
  • Merges and correlates data from multiple sources
  • Displays results in a formatted table with columns for service, type, host, port, status, and last seen

Usage examples:

 # List all capabilities using default host
 wanaku capabilities list

 # List capabilities from a specific host
 wanaku capabilities list --host http://api.example.com:8080
 

Output format:

 service | serviceType       | host          | port | status | lastSeen
 --------|-------------------|---------------|------|--------|----------
 http    | tool-invoker      | 192.168.1.101 | 9000 | active | Monday, June 23, 2025 at 07:00:26
 sqs     | tool-invoker      | 192.168.1.101 | 9011 | active | Monday, June 16, 2025 at 13:22:29
 
See Also:
  • Constructor Details

    • CapabilitiesList

      public CapabilitiesList()
  • Method Details

    • doCall

      public Integer doCall(org.jline.terminal.Terminal terminal, WanakuPrinter printer) throws IOException, Exception
      Executes the capabilities listing command.

      This method orchestrates the entire process of:

      1. Creating a terminal instance for output
      2. Initializing the targets service with the specified host
      3. Fetching and merging capabilities data from the API
      4. Displaying the results in a formatted table

      The method uses a try-with-resources block to ensure proper terminal cleanup and includes timeout handling for API operations.

      Specified by:
      doCall in class BaseCommand
      Returns:
      BaseCommand.EXIT_OK if the command executes successfully
      Throws:
      Exception - if there's an error during execution, including:
      • API communication failures
      • Terminal creation issues
      • Data processing errors
      • Timeout while waiting for API responses
      IOException