| |
| """Validate canonical registry metadata, eligibility, and local artifacts.""" |
|
|
| from __future__ import annotations |
|
|
| import argparse |
| import json |
| from pathlib import Path |
|
|
| from registry_common import read_registry, validate_registry |
|
|
|
|
| def main() -> int: |
| parser = argparse.ArgumentParser(description=__doc__) |
| parser.add_argument("registry", type=Path) |
| parser.add_argument("--verify-files", action="store_true") |
| parser.add_argument("--require-complete", action="store_true") |
| args = parser.parse_args() |
| rows = read_registry(args.registry.resolve()) |
| errors = validate_registry(rows, args.verify_files, args.require_complete) |
| counts: dict[str, int] = {} |
| for row in rows: |
| counts[row["eligibility"]] = counts.get(row["eligibility"], 0) + 1 |
| result = { |
| "registry": str(args.registry.resolve()), |
| "status": "FAIL" if errors else "PASS", |
| "candidate_count": len(rows), |
| "task_count": len({row["task"] for row in rows}), |
| "eligibility_counts": dict(sorted(counts.items())), |
| "verify_files": args.verify_files, |
| "require_complete": args.require_complete, |
| "errors": errors, |
| } |
| print(json.dumps(result, indent=2, sort_keys=True, ensure_ascii=False)) |
| return 1 if errors else 0 |
|
|
|
|
| if __name__ == "__main__": |
| raise SystemExit(main()) |
|
|
|
|