Doctor Command API Reference¶
This section documents the internals of the doctor
command in Bijux CLI.
bijux_cli.commands.doctor ¶
Implements the doctor
command for the Bijux CLI.
This module provides the functionality for the bijux doctor
command, which runs a series of health diagnostics on the CLI's operating environment. It checks for common configuration issues and reports a summary of its findings in a structured, machine-readable format suitable for automation.
Output Contract
- Success:
{"status": str, "summary": list[str]}
- Verbose: Adds
{"python": str, "platform": str}
to the payload. - Error:
{"error": str, "code": int}
Exit Codes
0
: Success (command ran without errors, regardless of health status).1
: Internal or fatal error (e.g., dependency injection failure).2
: CLI argument or flag error.
doctor ¶
doctor(
ctx: Context,
quiet: bool = Option(
False, "-q", "--quiet", help=HELP_QUIET
),
verbose: bool = Option(
False, "-v", "--verbose", help=HELP_VERBOSE
),
fmt: str = Option(
"json", "-f", "--format", help=HELP_FORMAT
),
pretty: bool = Option(
True, "--pretty/--no-pretty", help=HELP_NO_PRETTY
),
debug: bool = Option(
False, "-d", "--debug", help=HELP_DEBUG
),
) -> None
Defines the entrypoint and logic for the bijux doctor
command.
This function orchestrates the health check process. It validates all CLI flags, performs critical pre-flight checks (like dependency availability), and then invokes the main run utility to build and emit the health payload.
Parameters:
-
ctx
(Context
) –The Typer context for managing command state.
-
quiet
(bool
, default:Option(False, '-q', '--quiet', help=HELP_QUIET)
) –If True, suppresses all output; the exit code is the primary indicator of the outcome.
-
verbose
(bool
, default:Option(False, '-v', '--verbose', help=HELP_VERBOSE)
) –If True, includes Python and platform details in the output payload.
-
fmt
(str
, default:Option('json', '-f', '--format', help=HELP_FORMAT)
) –The output format, either "json" or "yaml". Defaults to "json".
-
pretty
(bool
, default:Option(True, '--pretty/--no-pretty', help=HELP_NO_PRETTY)
) –If True, pretty-prints the output for human readability.
-
debug
(bool
, default:Option(False, '-d', '--debug', help=HELP_DEBUG)
) –If True, enables debug diagnostics, implying
verbose
andpretty
.
Returns:
-
None
(None
) –
Raises:
-
SystemExit
–Exits the application with a contract-compliant status code and payload upon any error, such as invalid arguments or an internal system failure.
Source code in src/bijux_cli/commands/doctor.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|