"""Smoke test execution CLI.""" from __future__ import annotations import argparse import asyncio import json import sys from pathlib import Path _ROOT = str(Path(__file__).resolve().parent.parent.parent.parent) if _ROOT not in sys.path: sys.path.insert(0, _ROOT) from typing import Any, Dict from src.runtime.cli.consolidate import run_consolidation def run_smoke_test( config_path: Path | str = "runtime_config.local.json", article_path: Path | str = "examples/sample_article_valid.json", ecp_path: Path | str = "examples/sample_ecp_snapshot.json", ) -> Dict[str, Any]: exit_code = asyncio.run(run_consolidation(article_path, ecp_path, config_path)) return { "status": "PASS" if exit_code == 0 else "FAIL", "exit_code": exit_code, } def main() -> None: parser = argparse.ArgumentParser(description="Runtime smoke test CLI.") parser.add_argument( "--config", "-c", default="runtime_config.local.json", help="Path to config." ) parser.add_argument( "--input", "-i", default="examples/sample_article_valid.json", help="Path to sample article.", ) parser.add_argument( "--ecp", "-e", default="examples/sample_ecp_snapshot.json", help="Path to sample ECP." ) args = parser.parse_args() result = run_smoke_test(args.config, args.input, args.ecp) print(json.dumps(result, indent=2)) sys.exit(0 if result["status"] == "PASS" else 1) if __name__ == "__main__": main()