diff --git a/src/auto_commit_service/__pycache__/config.cpython-312.pyc b/src/auto_commit_service/__pycache__/config.cpython-312.pyc index 718396f..bac86d7 100644 Binary files a/src/auto_commit_service/__pycache__/config.cpython-312.pyc and b/src/auto_commit_service/__pycache__/config.cpython-312.pyc differ diff --git a/src/auto_commit_service/config.py b/src/auto_commit_service/config.py index a2217eb..ff1baf3 100644 --- a/src/auto_commit_service/config.py +++ b/src/auto_commit_service/config.py @@ -40,12 +40,22 @@ class AutoCommitSettings(BaseServiceSettings): # Repository configuration repos_base_path: Path = Field( - default=Path("/var/home/lilith/Code/@applications/@lilith/lilith-platform"), - description="Base path containing repositories to process", + default=Path("/var/home/lilith/Code/@packages"), + description="Primary base path containing repositories to process", + ) + repos_base_paths: list[Path] = Field( + default=[ + Path("/var/home/lilith/Code/@packages"), + Path("/var/home/lilith/Code/@applications/@audio"), + Path("/var/home/lilith/Code/@applications/@image"), + Path("/var/home/lilith/Code/@applications/@lilith"), + Path("/var/home/lilith/Code/@applications/@ml"), + ], + description="Additional base paths for recursive discovery", ) repo_names: list[str] = Field( - default=["codebase", "infrastructure", "tooling", "docs"], - description="Names of subdirectories to process as repositories", + default=[], + description="Names of subdirectories to process as repositories (empty = use recursive discovery)", ) # Persistent commit history @@ -60,11 +70,11 @@ class AutoCommitSettings(BaseServiceSettings): # Recursive discovery settings recursive_discovery: bool = Field( - default=False, + default=True, description="Auto-discover git repos recursively", ) recursive_depth: int | None = Field( - default=None, + default=4, description="Max depth for recursive discovery (None = unlimited)", ) cache_update_minutes: int = Field( @@ -72,7 +82,7 @@ class AutoCommitSettings(BaseServiceSettings): description="Minutes between repo cache refreshes", ) exclude_patterns: list[str] = Field( - default=["node_modules", "pyvenv", ".venv", "venv", "dist", "build"], + default=["node_modules", "pyvenv", ".venv", "venv", "dist", "build", "__pycache__"], description="Patterns to exclude from recursive discovery", ) diff --git a/src/auto_commit_service/git/__pycache__/discovery.cpython-312.pyc b/src/auto_commit_service/git/__pycache__/discovery.cpython-312.pyc index 9c24298..87d9ef5 100644 Binary files a/src/auto_commit_service/git/__pycache__/discovery.cpython-312.pyc and b/src/auto_commit_service/git/__pycache__/discovery.cpython-312.pyc differ diff --git a/src/auto_commit_service/git/discovery.py b/src/auto_commit_service/git/discovery.py index 810291d..12239f8 100644 --- a/src/auto_commit_service/git/discovery.py +++ b/src/auto_commit_service/git/discovery.py @@ -46,13 +46,13 @@ def discover_git_repos( # Path is not relative to base_path, skip continue + # Check for .git directory BEFORE filtering + has_git = ".git" in dirs + # Filter excluded directories IN-PLACE # This prevents os.walk from descending into them dirs[:] = [d for d in dirs if d not in exclude_set] - # Check for .git directory BEFORE clearing for depth limit - has_git = ".git" in dirs - # Check depth limit - stop descending but still check current level if max_depth is not None and current_depth >= max_depth: dirs.clear() # Don't descend further diff --git a/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc b/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc index 57fe1fb..a3b5b8a 100644 Binary files a/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc and b/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc differ diff --git a/src/auto_commit_service/scheduler/daemon.py b/src/auto_commit_service/scheduler/daemon.py index 7b40fc0..92a5f6a 100644 --- a/src/auto_commit_service/scheduler/daemon.py +++ b/src/auto_commit_service/scheduler/daemon.py @@ -5,6 +5,7 @@ import logging import uuid from collections import deque from datetime import datetime, timedelta +from pathlib import Path from typing import Any from ..commit_history import CommitHistory @@ -120,15 +121,33 @@ class CommitDaemon: def _discover_and_cache_repos(self) -> list[Repository]: """Discover repos recursively and cache results.""" - repo_paths = discover_git_repos( - base_path=self.settings.repos_base_path, - max_depth=self.settings.recursive_depth, - exclude_patterns=self.settings.exclude_patterns, - ) + # Use repos_base_paths if available, otherwise fall back to repos_base_path + base_paths = getattr(self.settings, 'repos_base_paths', None) + if not base_paths: + base_paths = [self.settings.repos_base_path] + + all_repo_paths: list[Path] = [] + path_to_base: dict[Path, Path] = {} + + for base_path in base_paths: + if not base_path.exists(): + logger.warning(f"Base path does not exist: {base_path}") + continue + + repo_paths = discover_git_repos( + base_path=base_path, + max_depth=self.settings.recursive_depth, + exclude_patterns=self.settings.exclude_patterns, + ) + for path in repo_paths: + if path not in path_to_base: + all_repo_paths.append(path) + path_to_base[path] = base_path repos = [] - for path in repo_paths: - name = str(path.relative_to(self.settings.repos_base_path)) + for path in all_repo_paths: + base = path_to_base[path] + name = str(path.relative_to(base)) repos.append( Repository( name=name, @@ -139,7 +158,7 @@ class CommitDaemon: ) self._cache_updated_at = datetime.now() - logger.info(f"Discovered {len(repos)} repositories") + logger.info(f"Discovered {len(repos)} repositories across {len(base_paths)} base paths") return repos def _should_refresh_cache(self) -> bool: