diff --git a/gnommo/cli.py b/gnommo/cli.py index ef0386d..84c18ca 100644 --- a/gnommo/cli.py +++ b/gnommo/cli.py @@ -2935,6 +2935,31 @@ def cmd_description(project_path: Path, verbose: bool) -> int: return 0 +# Files and directories excluded from all sync/archive/load operations. +# Covers intermediate processing artifacts, chunk scratch dirs, venv, and +# common OS/editor noise. +_RSYNC_EXCLUDES = [ + # Intermediate processing files + "media/narration/intermediate/", + "media/narration/intermediate/**", + "media/videos/intermediate/", + "media/videos/intermediate/**", + "media/videos/processed/", + "media/videos/processed/**", + # Chunk scratch directories + "**/chunks/", + "**/chunks/**", + # Python + "*.py", + "__pycache__/", + "venv/", + # Version control / OS noise + ".git/", + ".DS_Store", + "*.tmp", +] + + def cmd_archive(project_path: Path, verbose: bool, dry_run: bool) -> int: """Archive project files to external cache storage.""" from .cache import load_cache_config @@ -2963,19 +2988,11 @@ def cmd_archive(project_path: Path, verbose: bool, dry_run: bool) -> int: if not dry_run: dest_path.mkdir(parents=True, exist_ok=True) - # Use rsync to sync media files - # -a: archive mode (preserves permissions, timestamps, etc.) - # -v: verbose - # --progress: show progress - # --exclude: skip files we don't want to sync rsync_cmd = [ "rsync", "-av", "--progress", - "--exclude=*.py", - "--exclude=__pycache__", - "--exclude=.git", - "--exclude=.DS_Store", + *[f"--exclude={p}" for p in _RSYNC_EXCLUDES], f"{project_path}/", f"{dest_path}/", ] @@ -3052,10 +3069,7 @@ def cmd_load(project_path: Path, verbose: bool, dry_run: bool) -> int: "rsync", "-av", "--progress", - "--exclude=*.py", - "--exclude=__pycache__", - "--exclude=.git", - "--exclude=.DS_Store", + *[f"--exclude={p}" for p in _RSYNC_EXCLUDES], f"{src_path}/", f"{project_path}/", ] @@ -3147,10 +3161,7 @@ def cmd_sync(project_path: Path, verbose: bool, dry_run: bool, download: bool) - "-av", "--progress", "-e", f"ssh -p {server['port']}", - "--exclude=*.py", - "--exclude=__pycache__", - "--exclude=.git", - "--exclude=.DS_Store", + *[f"--exclude={p}" for p in _RSYNC_EXCLUDES], src, dest, ]