39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Extract the wizard-work git worktree census at HEAD (2026-11-02, extract lane).
|
|
|
|
Writes:
|
|
wizard-work-census-2026-11-02.json : full census (flags, author census,
|
|
remote topology, top-modified files)
|
|
wizard-work-census-2026-11-02.csv : top-modified-files table (rank,path,commits)
|
|
|
|
Re-derivation test: the CHECK re-runs derive() from the live git tree and
|
|
compares the committed JSON field-for-field; exits 0 only on exact match.
|
|
"""
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
from wizard_work_census import derive # noqa: E402
|
|
|
|
OUT = Path(__file__).resolve().parent
|
|
|
|
|
|
def main():
|
|
data = derive()
|
|
json_path = OUT / "wizard-work-census-2026-11-02.json"
|
|
csv_path = OUT / "wizard-work-census-2026-11-02.csv"
|
|
json_path.write_text(json.dumps(data, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
with csv_path.open("w", encoding="utf-8") as fh:
|
|
fh.write("rank,path,commits\n")
|
|
for i, entry in enumerate(data["top_modified_files"], 1):
|
|
fh.write(f"{i},{entry['path']},{entry['commits']}\n")
|
|
print(f"[extract] wrote {json_path} ({len(data['author_census'])} authors, "
|
|
f"{len(data['top_modified_files'])} top-modified files)")
|
|
print(f"[extract] wrote {csv_path}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|