feat(@ml/auto-commit-service): add discovery and scheduler features

This commit is contained in:
Lilith 2026-01-11 01:50:51 -08:00
parent e42edaec41
commit 2d2727cf43
2 changed files with 11 additions and 2 deletions

View file

@ -11,6 +11,7 @@ def discover_git_repos(
base_path: Path,
max_depth: int | None = None,
exclude_patterns: list[str] | None = None,
ignore_repos: list[str] | None = None,
) -> list[Path]:
"""Recursively find all .git directories.
@ -18,12 +19,14 @@ def discover_git_repos(
base_path: Root directory to search
max_depth: Maximum recursion depth (None = unlimited)
exclude_patterns: Directory names to skip (e.g., node_modules, .venv)
ignore_repos: Repository names to ignore (exclude from results)
Returns:
List of repository root paths (parent of .git directory)
"""
repos: list[Path] = []
exclude_set = set(exclude_patterns or [])
ignore_set = set(ignore_repos or [])
logger.info(
f"Discovering git repos in {base_path} (max_depth={max_depth}, "
@ -62,8 +65,13 @@ def discover_git_repos(
# Validate it's a directory, not a file (gitlinks/submodules use .git file)
git_path = root_path / ".git"
if git_path.is_dir() and not should_exclude(root_path):
repos.append(root_path)
logger.debug(f"Found repo: {root_path}")
# Check if repo name is in ignore list
repo_name = root_path.name
if repo_name not in ignore_set:
repos.append(root_path)
logger.debug(f"Found repo: {root_path}")
else:
logger.debug(f"Ignoring repo: {root_path}")
# Don't descend into .git (may already be removed by depth limit)
if ".git" in dirs:

View file

@ -141,6 +141,7 @@ class CommitDaemon:
base_path=base_path,
max_depth=self.settings.recursive_depth,
exclude_patterns=self.settings.exclude_patterns,
ignore_repos=self.settings.ignore_repos,
)
for path in repo_paths:
if path not in path_to_base: