The Garak CLI entry point chains from pyproject.toml registration through garak.__main__:main() to garak.cli.main(), which parses all command-line invocations as a Python module via python -m garak. Garak configures stdout to UTF-8 when invoked directly, ensuring consistent text handling across CLI entry paths.
The garak CLI entry point is registered via pyproject.toml and delegates to garak.__main__:main, which calls garak.cli.main(sys.argv[1:]).[1] When garak/__main__.py is run directly (i.e., python -m garak), stdout is reconfigured to UTF-8 before main() is called.[1] garak/cli.py is the entry point for all command-line invocations; its main() function is documented as the "Main entry point for garak runs invoked from the CLI".[2] The argparse program name in garak/cli.py is set to python -m garak, indicating the canonical invocation style is as a Python module.[2] garak/__main__.py reconfigures sys.stdout to UTF-8 to prevent UnicodeEncodeError when probe or result strings contain non-ASCII characters on systems with non-UTF-8 default locales (e.g., Windows cp1252).
Sources