#!/usr/bin/env python3 """Validate deploy exclusion rules for Docker build and local-to-server sync.""" from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[1] REQUIRED_PATTERNS = [ "frontend-v2/node_modules", ".venv-*", ".pytest_cache", ".ruff_cache", ".playwright-mcp", "2025.2", "=2025.2", "*.bak-", ] FILES = [ ROOT / ".dockerignore", ROOT / "deploy" / "rsync-local-to-server.sh", ] def main() -> int: missing: list[tuple[str, str]] = [] for path in FILES: text = path.read_text(encoding="utf-8", errors="replace") for pattern in REQUIRED_PATTERNS: if pattern not in text: missing.append((path.relative_to(ROOT).as_posix(), pattern)) if missing: print("ERROR: missing deploy exclusion patterns:") for rel, pattern in missing: print(f"- {rel}: {pattern}") return 1 print("OK: deploy exclusion patterns are present") return 0 if __name__ == "__main__": raise SystemExit(main())