(base: Path | None = None)
| 17 | |
| 18 | |
| 19 | def build_port_context(base: Path | None = None) -> PortContext: |
| 20 | root = base or Path(__file__).resolve().parent.parent |
| 21 | source_root = root / 'src' |
| 22 | tests_root = root / 'tests' |
| 23 | assets_root = root / 'assets' |
| 24 | archive_root = root / 'archive' / 'claude_code_ts_snapshot' / 'src' |
| 25 | return PortContext( |
| 26 | source_root=source_root, |
| 27 | tests_root=tests_root, |
| 28 | assets_root=assets_root, |
| 29 | archive_root=archive_root, |
| 30 | python_file_count=sum(1 for path in source_root.rglob('*.py') if path.is_file()), |
| 31 | test_file_count=sum(1 for path in tests_root.rglob('*.py') if path.is_file()), |
| 32 | asset_file_count=sum(1 for path in assets_root.rglob('*') if path.is_file()), |
| 33 | archive_available=archive_root.exists(), |
| 34 | ) |
| 35 | |
| 36 | |
| 37 | def render_context(context: PortContext) -> str: |
no test coverage detected