#!/usr/bin/env python3 """Convert the TSV census into a human-readable markdown table.""" SRC = "/root/troupe-standup/wizard-work/ledger/2026-10-25-workqueue-census.tsv" OUT = "/root/troupe-standup/wizard-work/ledger/2026-10-25-workqueue-census.md" with open(SRC, encoding="utf-8") as fh: lines = fh.read().splitlines() header = lines[0].split("\t") rows = [ln.split("\t") for ln in lines[1:] if ln] col_count = len(header) print(f"rows: {len(rows)}") def esc(cell: str) -> str: return cell.replace("|", "|") with open(OUT, "w", encoding="utf-8") as fh: fh.write("# Work-queue census — extraction of every numbered Q item from WORK-QUEUE.md\n\n") fh.write(f"Source: `WORK-QUEUE.md` (rows = `^## Q — ` headings, count {len(rows)}).\n\n") fh.write("| Q | Title | Status | Target |\n") fh.write("|---|---|---|---|\n") for r in rows: fh.write("| " + " | ".join(esc(c) for c in r) + " |\n") print(f"written: {OUT}")