List LLM providers (plural form defaults to 'list' command).
(
subcommand: str | None = typer.Argument(
None, help="Subcommand: list, config, diagnostic, set, or provider name"
),
provider_name: str | None = typer.Argument(
None, help="Provider name (for set or switch commands)"
),
key: str | None = typer.Argument(None, help="Config key (for set command)"),
value: str | None = typer.Argument(None, help="Config value (for set command)"),
model: str | None = typer.Option(
None, "--model", help="Model name (for switch commands)"
),
config_file: str = typer.Option(
"server_config.json", help="Configuration file path"
),
server: str | None = typer.Option(None, help="Server to connect to"),
disable_filesystem: bool = typer.Option(False, help="Disable filesystem access"),
quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"),
verbose: bool = typer.Option(
False, "-v", "--verbose", help="Enable verbose logging"
),
log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"),
theme: str = typer.Option("default", "--theme", help="UI theme"),
)
| 992 | # ADD: providers command as alias to provider (for consistency) |
| 993 | @app.command("providers", help="List LLM providers (defaults to list)") |
| 994 | def providers_command( |
| 995 | subcommand: str | None = typer.Argument( |
| 996 | None, help="Subcommand: list, config, diagnostic, set, or provider name" |
| 997 | ), |
| 998 | provider_name: str | None = typer.Argument( |
| 999 | None, help="Provider name (for set or switch commands)" |
| 1000 | ), |
| 1001 | key: str | None = typer.Argument(None, help="Config key (for set command)"), |
| 1002 | value: str | None = typer.Argument(None, help="Config value (for set command)"), |
| 1003 | model: str | None = typer.Option( |
| 1004 | None, "--model", help="Model name (for switch commands)" |
| 1005 | ), |
| 1006 | config_file: str = typer.Option( |
| 1007 | "server_config.json", help="Configuration file path" |
| 1008 | ), |
| 1009 | server: str | None = typer.Option(None, help="Server to connect to"), |
| 1010 | disable_filesystem: bool = typer.Option(False, help="Disable filesystem access"), |
| 1011 | quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"), |
| 1012 | verbose: bool = typer.Option( |
| 1013 | False, "-v", "--verbose", help="Enable verbose logging" |
| 1014 | ), |
| 1015 | log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"), |
| 1016 | theme: str = typer.Option("default", "--theme", help="UI theme"), |
| 1017 | ) -> None: |
| 1018 | """List LLM providers (plural form defaults to 'list' command).""" |
| 1019 | # Configure logging and theme for this command |
| 1020 | _setup_command_logging(quiet, verbose, log_level, theme) |
| 1021 | |
| 1022 | # Build arguments list for the provider action |
| 1023 | args = [] |
| 1024 | |
| 1025 | # Handle different command patterns |
| 1026 | if subcommand is None: |
| 1027 | # CHANGED: No arguments for "providers" defaults to list (not status) |
| 1028 | args = ["list"] |
| 1029 | elif subcommand in ["list", "config", "diagnostic"]: |
| 1030 | # Command without provider name |
| 1031 | args = [subcommand] |
| 1032 | if provider_name and subcommand == "diagnostic": |
| 1033 | # diagnostic can take a provider name |
| 1034 | args.append(provider_name) |
| 1035 | elif subcommand == "set": |
| 1036 | # set command: set <provider> <key> <value> |
| 1037 | if not provider_name or not key or not value: |
| 1038 | output.error("set command requires: providers set <provider> <key> <value>") |
| 1039 | raise typer.Exit(1) |
| 1040 | args = [subcommand, provider_name, key, value] |
| 1041 | else: |
| 1042 | # Assume subcommand is a provider name for switching |
| 1043 | args = [subcommand] # provider name |
| 1044 | if provider_name: |
| 1045 | # Second argument is model name |
| 1046 | args.append(provider_name) |
| 1047 | elif model: |
| 1048 | # Model specified via --model option |
| 1049 | args.append(model) |
| 1050 | |
| 1051 | _run_provider_command(args, "Providers command") |
nothing calls this directly
no test coverage detected