Construct the full AutoPT CLI argument parser with all subcommands.
()
| 54 | |
| 55 | |
| 56 | def build_parser() -> argparse.ArgumentParser: |
| 57 | """Construct the full AutoPT CLI argument parser with all subcommands.""" |
| 58 | parser = argparse.ArgumentParser(description="AutoPT unified CLI.") |
| 59 | subparsers = parser.add_subparsers(dest="command", required=True) |
| 60 | |
| 61 | benchmark_parser = subparsers.add_parser( |
| 62 | "benchmark", |
| 63 | help="Inspect benchmark files.", |
| 64 | description=BENCHMARK_HELP, |
| 65 | ) |
| 66 | benchmark_subparsers = benchmark_parser.add_subparsers(dest="benchmark_command", required=True) |
| 67 | benchmark_list_parser = benchmark_subparsers.add_parser( |
| 68 | "list", |
| 69 | help="List benchmark item names from a benchmark JSONL file.", |
| 70 | ) |
| 71 | benchmark_list_parser.add_argument("--benchmark-file", required=True, help="Path to benchmark JSONL.") |
| 72 | benchmark_list_parser.add_argument( |
| 73 | "--verbose", |
| 74 | action="store_true", |
| 75 | help="Include target, category, and difficulty information.", |
| 76 | ) |
| 77 | |
| 78 | inspect_parser = subparsers.add_parser( |
| 79 | "inspect", |
| 80 | help="Inspect a benchmark and model mapping without running the workflow.", |
| 81 | ) |
| 82 | inspect_parser.add_argument("--benchmark-file", required=True, help="Path to benchmark JSONL.") |
| 83 | inspect_parser.add_argument("--benchmark-name", required=True, help="Benchmark item name.") |
| 84 | inspect_parser.add_argument("--model", default=None, help=MODEL_HELP) |
| 85 | inspect_parser.add_argument( |
| 86 | "--config-file", |
| 87 | default=None, |
| 88 | help="Optional YAML config file. Used to resolve llm.default_provider and llm.default_model.", |
| 89 | ) |
| 90 | |
| 91 | run_parser = subparsers.add_parser( |
| 92 | "run", |
| 93 | help="Run one benchmark task through the shared workflow.", |
| 94 | ) |
| 95 | run_parser.add_argument("--benchmark-file", required=True, help="Path to benchmark JSONL.") |
| 96 | run_parser.add_argument("--benchmark-name", required=True, help="Benchmark item name.") |
| 97 | run_parser.add_argument("--model", default=None, help=MODEL_HELP) |
| 98 | run_parser.add_argument("--ip-addr", required=True, help="Target ip:port.") |
| 99 | run_parser.add_argument( |
| 100 | "--prompt-bundle", |
| 101 | default="default", |
| 102 | choices=list_prompt_bundle_names(), |
| 103 | help="Prompt bundle name.", |
| 104 | ) |
| 105 | run_parser.add_argument( |
| 106 | "--config-file", |
| 107 | default=None, |
| 108 | help="Optional YAML config file. Defaults to configs/config.yml if present.", |
| 109 | ) |
| 110 | run_parser.add_argument( |
| 111 | "--output-file", |
| 112 | default=None, |
| 113 | help="Optional JSONL file for writing the task result.", |
no test coverage detected