Skip to content

instruments

instruments

Instrument management commands — mzt instruments list|check.

These commands let users discover available instruments, check their readiness, and diagnose configuration issues. They build on the InstrumentProfileLoader and InstrumentRegistry — YAML profiles loaded from built-in, organization, and venue directories.

The music metaphor: these commands are the instrument workshop's front desk. list shows what's on the rack. check picks one up and plays a test note.

Classes

Functions

instruments_callback

instruments_callback(ctx)

Show instrument overview if no subcommand given.

Source code in src/marianne/cli/commands/instruments.py
@instruments_app.callback(invoke_without_command=True)
def instruments_callback(ctx: typer.Context) -> None:
    """Show instrument overview if no subcommand given."""
    if ctx.invoked_subcommand is None:
        # Default to list when called without a subcommand
        ctx.invoke(list_instruments)

list_instruments

list_instruments(json_output=Option(False, '--json', help='Output as JSON'))

List all available instruments and their readiness status.

Source code in src/marianne/cli/commands/instruments.py
@instruments_app.command(name="list")
def list_instruments(
    json_output: bool = typer.Option(
        False, "--json", help="Output as JSON",
    ),
) -> None:
    """List all available instruments and their readiness status."""
    profiles = _load_all_profiles()

    if not profiles:
        if json_output:
            console.print("[]")
        else:
            console.print(
                "[dim]No instruments configured.[/dim]\n"
                "Add instrument profiles to ~/.marianne/instruments/ "
                "or .marianne/instruments/"
            )
        return

    if json_output:
        _list_json(profiles)
    else:
        _list_table(profiles)

check_instrument

check_instrument(name=Argument(help='Instrument name to check'), json_output=Option(False, '--json', help='Output as JSON'))

Check readiness and configuration of a specific instrument.

Source code in src/marianne/cli/commands/instruments.py
@instruments_app.command(name="check")
def check_instrument(
    name: str = typer.Argument(help="Instrument name to check"),
    json_output: bool = typer.Option(
        False, "--json", help="Output as JSON",
    ),
) -> None:
    """Check readiness and configuration of a specific instrument."""
    profiles = _load_all_profiles()

    if name not in profiles:
        if json_output:
            output_json({"error": f"Unknown instrument: {name}"})
        else:
            output_error(
                f"Unknown instrument: '{name}'",
                error_code="INSTR-001",
                hints=[
                    "Run 'mzt instruments list' to see available instruments",
                    "Add profiles to ~/.marianne/instruments/ or .marianne/instruments/",
                ],
            )
        raise typer.Exit(1)

    profile = profiles[name]

    if json_output:
        _check_json(profile)
    else:
        _check_rich(profile)