"""Typed CLI context."""

import typer
from mm_clikit import AppContext
from mm_clikit import use_context as _use_context

from mb_stash.cli.output import Output
from mb_stash.config import Config
from mb_stash.service import Service


def use_context(ctx: typer.Context) -> AppContext[Service, Output, Config]:
    """Extract typed app context from Typer context."""
    return _use_context(ctx, AppContext[Service, Output, Config])


def password_prompt() -> str:
    """Prompt user for master password."""
    result: str = typer.prompt("Enter master password", hide_input=True)
    return result
