Skip to content
Automation
Command

/list

List all available CLI-Anything tools (installed and generated).

From plugin
cli-anything
47k5 skills5 commands
Install
> /plugin marketplace add HKUDS/CLI-Anything
> /plugin install cli-anything@cli-anything

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/list

Context preview

What this command does when you run it.

List all available CLI-Anything tools (installed and generated).

Command definition

list.md

cli-anything:list Command

List all available CLI-Anything tools (installed and generated).

Usage

/cli-anything:list [--path <directory>] [--depth <n>] [--json]

Options

  • `--path <directory>` - Directory to search for generated CLIs (default: current directory)
  • `--depth <n>` - Maximum recursion depth for scanning (default: unlimited). Use `0` for current directory only, `1` for one level deep, etc.
  • `--json` - Output in JSON format for machine parsing

What This Command Does

Displays all CLI-Anything tools available in the system:

1. Installed CLIs

Uses `importlib.metadata` to find installed `cli-anything-*` packages:

  • Pattern: package name starts with `cli-anything-`
  • Extracts: software name, version, entry point
from importlib.metadata import distributions

installed = {}
for dist in distributions():
    name = dist.metadata.get("Name", "")
    if name.startswith("cli-anything-"):
        software = name.replace("cli-anything-", "")
        version = dist.version
        # Find executable via entry points or shutil.which
        executable = shutil.which(f"cli-anything-{software}")
        installed[software] = {
            "status": "installed",
            "version": version,
            "executable": executable
        }

2. Generated CLIs

Uses `glob` to find local CLI directories:

  • Pattern: `**/agent-harness/cli_anything/*/__init__.py` (or depth-limited variant)
  • Extracts: software name, version (from setup.py), source path
  • Status: `generated`
from pathlib import Path
import glob
import re

search_path = args.get("path", ".")
max_depth = args.get("depth", None)  # None means unlimited
generated = {}

def extract_version_from_setup(setup_path):
    """Extract version from setup.py using regex."""
    try:
        content = Path(setup_path).read_text()
        match = re.search(r'version\s*=\s*["\']([^"\']+)["\']', content)
        return match.group(1) if match else None
    except:
        return None

def build_glob_patterns(base_path, depth):
    """Build list of glob patterns for depths 0 through max_depth.

    Returns multiple patterns so that --depth 2 finds tools at depth 0, 1, AND 2.
    """
    base = Path(base_path)
    suffix = "agent-harness/cli_anything/*/__init__.py"

    if depth is None:
        # Unlimited depth: use **
        return [str(base / "**" / suffix)]

    # Generate patterns for all depths from 0 to max_depth
    patterns = []
    for d in range(depth + 1):
        if d == 0:
            # depth 0: look in current directory
            patterns.append(str(base / suffix))
        else:
            # depth N: look N levels deep
            prefix = "/".join(["*"] * d)
            patterns.append(str(base / prefix / suffix))
    return patterns

patterns = build_glob_patterns(search_path, max_depth)
for pattern in patterns:
    for init_file in glob.glob(pattern, recursive=True):
        parts = Path(init_file).parts
        # Find cli_anything/<software> pattern
        for i, p in enumerate(parts):
            if p == "cli_anything" and i + 1 < len(parts):
                software = parts[i + 1]
                # Get agent-harness directory as source
                agent_harness_idx = parts.index("agent-harness") if "agent-harness" in parts else i - 1
                source = str(Path(*parts[:agent_harness_idx + 2]))  # up to agent-harness
                # Extract version from setup.py (setup.py is in agent-harness/, not cli_anything/)
                setup_path = Path(*parts[:agent_harness_idx + 1]) / "setup.py"
                version = extract_version_from_setup(setup_path)
                generated[software] = {
                    "status": "generated",
                    "version": version,
                    "executable": None,
                    "source": source
                }
                break

3. Merge Results

  • Deduplicate by software name
  • If both installed and generated: show `installed` status with both paths
  • The `source` field shows where the generated code is (even for installed)

Output Formats

Table Format (default)

CLI-Anything Tools (found 5)

Name            Status      Version   Source
──────────────────────────────────────────────────────────────
gimp            installed   1.0.0     ./gimp/agent-harness
blender         installed   1.0.0     ./blender/agent-harness
inkscape        generated   1.0.0     ./inkscape/agent-harness
audacity        generated   1.0.0     ./audacity/agent-harness
libreoffice     generated   1.0.0     ./libreoffice/agent-harness

JSON Format (--json)

{
  "tools": [
    {
      "name": "gimp",
      "status": "installed",
      "version": "1.0.0",
      "executable": "/usr/local/bin/cli-anything-gimp",
      "source": "./gimp/agent-harness"
    },
    {
      "name": "inkscape",
      "status": "generated",
      "version": "1.0.0",
      "executable": null,
      "source": "./inkscape/agent-harness"
    }
  ],
  "total": 2,
  "installed": 1,
  "generated_only": 1
}

Error Handling

| Scenario | Action | |----------|--------| | No CLIs found | Show "No CLI-Anything tools found" message | | Invalid --path | Show error: "Path not found: <path>" | | Permission denied | Skip directory, continue scanning, show warning |

Implementation Steps

When this command is invoked, the agent should:

1. **Parse arguments**

  • Extract `--path` value (default: `.`)
  • Extract `--depth` value (default: `None` for unlimited recursion)
  • Extract `--json` flag (default: false)

2. **Validate path exists**

  • If `--path` specified and doesn't exist, show error and exit

3. **Scan installed CLIs**

  • Use `importlib.metadata.distributions()` to find all packages
  • Filter for packages starting with `cli-anything-`
  • Extract name, version, find executable path

4. **Scan generated CLIs**

  • Build glob pattern based on depth parameter
  • Use `glob.glob(pattern, recursive=True)`
Read more
Ships withcli-anything

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Get the whole plugin