best_engine_ai_helper.cli_argparse module

cli_argparse — argparse-based command-line interface for best-engine-ai-helper.

Entry point: best-engine-ai-helper-argparse (registered in pyproject.toml).

The suite convention (see os-helper’s README, “Three surfaces, one codebase”) is: the argparse CLI is the zero-extra-runtime-dependency primary name, and a click twin ships as <pkg>-click. best-engine-ai-helper’s history inverts this — best-engine-ai-helper (the published, stable entry point) is already click-based, and click is a CORE dependency here, not an opt-in [cli] extra like elsewhere in the suite. Per CODING.md rule 20.1 (“do not migrate a stable existing CLI solely to change parser”), that entry point is left untouched. This module instead adds the missing SECOND surface as best-engine-ai-helper-argparse, mirroring every command 1:1 so both parsers expose the identical contract (same flags, same defaults, same output). Every handler delegates to the same library functions cli.py’s click commands call — no business logic is duplicated between the two CLIs.

Commands (identical to cli.py):

detect Print detected hardware as JSON. recommend Print ranked model candidates for this hardware. resolve Resolve a usage brief into a machine-specific engine file. report Recommend the best engine(s) for a task; emit MD + JSON. usages list/show/resolve Browse and resolve the sev7n usage catalog. catalog show/update Manage the model catalog. hardware show/update Manage the hardware chip table. pull Pull the best model and run Ralph validation gates. validate Run Ralph gates on the already-configured model. gui Launch the minimal browser GUI. env Print the env block for ~/.zshrc or sourcing.

Author

Warith Harchaoui <warith.harchaoui@deraison.ai>

best_engine_ai_helper.cli_argparse.build_parser()[source]

Assemble the top-level best-engine-ai-helper-argparse parser.

Returns:

Fully wired parser with every subcommand attached, mirroring cli.py.

Return type:

argparse.ArgumentParser

best_engine_ai_helper.cli_argparse.main(argv=None)[source]

Entry point invoked by best-engine-ai-helper-argparse.

A subcommand handler’s own exception (a connection failure, a missing ollama binary, …) is caught here and turned into one clean Error: … line + exit 1, instead of propagating as a raw Python traceback – argparse itself already handles usage errors (bad flags, –help) via its own SystemExit, which this does not touch.

Parameters:

argv (sequence of str, optional) – Arguments to parse; defaults to sys.argv[1:].

Returns:

Process exit code.

Return type:

int