Skip to content

doctor_cmd

doctor_cmd

jarvis doctor — run diagnostic checks on the OpenJarvis installation.

Classes

CheckResult dataclass

CheckResult(name: str, status: str, message: str, details: Optional[str] = None)

Result of a single diagnostic check.

Functions

doctor

doctor(as_json: bool) -> None

Run diagnostic checks on your OpenJarvis installation.

Source code in src/openjarvis/cli/doctor_cmd.py
@click.command()
@click.option("--json", "as_json", is_flag=True, help="Output results as JSON.")
def doctor(as_json: bool) -> None:
    """Run diagnostic checks on your OpenJarvis installation."""
    checks = _run_all_checks()

    if as_json:
        click.echo(json.dumps(_results_to_dicts(checks), indent=2))
        return

    console = Console()
    console.print()
    console.print("[bold]OpenJarvis Doctor[/bold]")
    console.print()

    table = Table(show_header=True, header_style="bold")
    table.add_column("Status", width=3, justify="center")
    table.add_column("Check")
    table.add_column("Result")

    for check in checks:
        icon = _STATUS_ICONS.get(check.status, "?")
        message = check.message
        if check.details:
            message += f"\n  [dim]{check.details}[/dim]"
        table.add_row(icon, check.name, message)

    console.print(table)

    ok_count = sum(1 for c in checks if c.status == "ok")
    warn_count = sum(1 for c in checks if c.status == "warn")
    fail_count = sum(1 for c in checks if c.status == "fail")
    console.print()
    console.print(
        f"  {ok_count} passed, {warn_count} warnings, {fail_count} failures"
    )
    console.print()