Skip to main content
Branchfeature/review-demo
21 lines · 803 BBlameRaw
import argparse
import json
from pathlib import Path

def inspect_project(root):
    root = Path(root)
    files = sorted(path.relative_to(root).as_posix() for path in root.rglob("*")
                   if path.is_file() and not any(part.startswith(".") or part == "__pycache__" for part in path.relative_to(root).parts))
    return {"name": root.name, "files": files, "count": len(files)}

def main():
    parser = argparse.ArgumentParser(description="Inspect a demo project")
    parser.add_argument("path", nargs="?", default=".")
    parser.add_argument("--json", action="store_true")
    args = parser.parse_args()
    report = inspect_project(args.path)
    print(json.dumps(report, indent=2) if args.json else f"{report['name']}: {report['count']} files")

if __name__ == "__main__":
    main()