38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Validate an LLM summary JSON using the repository validator.")
|
|
parser.add_argument("result", type=Path, help="Path to the summary result JSON file")
|
|
parser.add_argument("--extracted", type=Path, default=None, help="Optional extracted article JSON file")
|
|
args = parser.parse_args()
|
|
|
|
repo_root = Path(__file__).resolve().parents[3]
|
|
sys.path.insert(0, str(repo_root / "src"))
|
|
|
|
from summary_mcp.validators.llm_result import validate_llm_result
|
|
|
|
report = validate_llm_result(args.result, args.extracted)
|
|
print(
|
|
json.dumps(
|
|
{
|
|
"valid": report.valid,
|
|
"errors": report.errors,
|
|
"warnings": report.warnings,
|
|
"normalized_result": report.normalized_result,
|
|
},
|
|
ensure_ascii=False,
|
|
indent=2,
|
|
)
|
|
)
|
|
raise SystemExit(0 if report.valid else 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|