()
| 64 | m = PY_FN_RE.match(line.strip()) |
| 65 | if not m: |
| 66 | continue |
| 67 | name = m.group(1) |
| 68 | if name.startswith("_"): |
| 69 | continue |
| 70 | fns.append(name) |
| 71 | if fns: |
| 72 | out[module] = sorted(set(fns)) |
| 73 | return out |
| 74 | |
| 75 | |
| 76 | def as_ts(rust_api: dict[str, list[str]], python_api: dict[str, list[str]]) -> str: |
| 77 | payload = { |
| 78 | "generatedAt": "generated-by-scripts/generate_api_inventory.py", |
| 79 | "rust": rust_api, |
| 80 | "python": python_api, |
| 81 | } |
| 82 | body = json.dumps(payload, indent=2, sort_keys=True) |
| 83 | return "// Generated file. Do not edit manually.\nexport const apiInventory = " + body + " as const;\n" |
| 84 | |
| 85 | |
| 86 | def main() -> int: |
| 87 | parser = argparse.ArgumentParser(description="Generate docs-site API inventory snapshot") |
| 88 | parser.add_argument("--check", action="store_true", help="Fail if generated output differs") |
no test coverage detected