///|
pub fn cli_usage_text() -> String {
  let lines : Array[String] = [
    "MoonRAGBench \{API_VERSION}",
    "",
    "Commands:",
    "  demo",
    "      Run the deterministic bundled benchmark.",
    "  eval --qrels FILE --run FILE [--format text|markdown|json|csv|jsonl]",
    "      Compute retrieval metrics and export a report.",
    "  validate --qrels FILE --run FILE [--format text|markdown|json]",
    "      Check identifiers, numeric values, duplicates, and coverage.",
    "  inspect --qrels FILE --run FILE",
    "      Print dataset and score distribution diagnostics.",
    "  compare --qrels FILE --baseline FILE --candidate FILE [--cutoff N]",
    "      Compare two runs by per-query nDCG and overlap.",
    "  sample-negatives --qrels FILE --run FILE [--count N]",
    "      Generate deterministic hard, tail, or stride negatives.",
    "",
    "Reproducibility:",
    "  Inputs are UTF-8 TSV; ties are ordered by document id.",
    "  No network or random state is required for evaluation.",
    "  The library can be published to Mooncakes with moon publish.",
  ]
  lines.join("\n")
}

///|
pub fn cli_format_name(format : CliFormat) -> String {
  match format {
    Text => "text"
    Markdown => "markdown"
    Json => "json"
    Csv => "csv"
    JsonLines => "jsonl"
  }
}

///|
pub fn cli_request_summary(request : CliRequest) -> String {
  match request {
    Demo => "demo".to_string()
    Eval(qrels_path~, run_path~, format~, cutoffs~, threshold~, gain~) => {
      let gain_name = match gain {
        Linear => "linear"
        Exp2 => "exp2"
      }
      "eval qrels=\{qrels_path} run=\{run_path} format=\{cli_format_name(format)} cutoffs=\{cutoffs.map(fn(item) { item.to_string() }).join(",")} threshold=\{threshold} gain=\{gain_name}"
    }
    Validate(qrels_path~, run_path~, format~) =>
      "validate qrels=\{qrels_path} run=\{run_path} format=\{cli_format_name(format)}"
    Compare(qrels_path~, baseline_path~, candidate_path~, cutoff~) =>
      "compare qrels=\{qrels_path} baseline=\{baseline_path} candidate=\{candidate_path} cutoff=\{cutoff}"
    Inspect(qrels_path~, run_path~) =>
      "inspect qrels=\{qrels_path} run=\{run_path}"
  }
}