Skip to content

registry_cmd

registry_cmd

jarvis registry — registry inspection commands.

Functions

registry

registry() -> None

Inspect registered components — list registries, show entries.

Source code in src/openjarvis/cli/registry_cmd.py
@click.group()
def registry() -> None:
    """Inspect registered components — list registries, show entries."""

list_registries

list_registries() -> None

List all available registries.

Source code in src/openjarvis/cli/registry_cmd.py
@registry.command("list")
def list_registries() -> None:
    """List all available registries."""
    console = Console(stderr=True)

    table = Table(title="Available Registries")
    table.add_column("Registry", style="cyan")
    table.add_column("Module", style="green")
    table.add_column("Entry Count", style="yellow")

    try:
        by_name, _ = _load_registry_map()
    except Exception as exc:
        console.print(f"[red]Error loading registries: {exc}[/red]")
        return

    module_path = "openjarvis.core.registry"
    for reg_name, registry_cls in by_name.items():
        try:
            count = len(registry_cls.keys())
            table.add_row(reg_name, module_path, str(count))
        except Exception as exc:
            table.add_row(reg_name, module_path, f"[red]Error: {exc}[/red]")

    console.print(table)

show

show(registry_name: str, verbose: bool) -> None

Show entries in a specific registry.

Source code in src/openjarvis/cli/registry_cmd.py
@registry.command()
@click.argument("registry_name")
@click.option(
    "--verbose", "-v", is_flag=True, default=False, help="Show full entry details"
)
def show(registry_name: str, verbose: bool) -> None:
    """Show entries in a specific registry."""
    console = Console(stderr=True)

    try:
        _, aliases = _load_registry_map()

        registry_cls = aliases.get(registry_name)
        if registry_cls is None:
            console.print(f"[red]Unknown registry: {registry_name}[/red]")
            console.print(
                "[dim]Run 'jarvis registry list' to see available registries.[/dim]"
            )
            return

        keys = registry_cls.keys()
        if not keys:
            console.print(f"[dim]{registry_name} is empty.[/dim]")
            return

        console.print(f"[bold]{registry_name}[/bold] — {len(keys)} entry/entries")

        if verbose:
            for key in keys:
                entry = registry_cls.get(key)
                console.print(f"\n  [cyan]{key}[/cyan]")
                console.print(f"    Type: {type(entry).__name__}")
                console.print(f"    Value: {entry}")
        else:
            table = Table()
            table.add_column("Key", style="cyan")
            table.add_column("Type", style="green")
            table.add_column("Value", style="white", max_width=80)
            for key in keys:
                entry = registry_cls.get(key)
                entry_type = type(entry).__name__
                entry_value = str(entry)
                table.add_row(key, entry_type, entry_value)
            console.print(table)

    except Exception as exc:
        console.print(f"[red]Error: {exc}[/red]")