Files
ewoooc/scripts/ops/report_codebase_modularization_performance.py
ogt 0c85209ea1
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
perf(runtime): isolate workers and compress web assets
2026-07-11 09:48:41 +08:00

35 lines
927 B
Python

#!/usr/bin/env python3
"""Report or persist the current codebase modularization/performance inventory."""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from services.codebase_modularization_performance_service import ( # noqa: E402
build_codebase_inventory,
write_codebase_inventory_receipt,
)
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--write", action="store_true", help="persist the latest runtime receipt")
args = parser.parse_args()
result = build_codebase_inventory()
if args.write:
result["receipt_path"] = str(write_codebase_inventory_receipt(result))
print(json.dumps(result, ensure_ascii=False, indent=2))
return 0
if __name__ == "__main__":
raise SystemExit(main())