175 lines
5.6 KiB
Python
175 lines
5.6 KiB
Python
"""Service configuration."""
|
|
|
|
from pathlib import Path
|
|
from pydantic import Field
|
|
from lilith_ml_service_base import BaseServiceSettings
|
|
|
|
|
|
class AutoCommitSettings(BaseServiceSettings):
|
|
"""Settings for the auto-commit service."""
|
|
|
|
# Server settings
|
|
host: str = Field(
|
|
default="0.0.0.0",
|
|
description="Host to bind the service to",
|
|
)
|
|
port: int = Field(
|
|
default=8200,
|
|
description="Port to bind the service to",
|
|
)
|
|
|
|
# Llama service connection
|
|
llama_service_url: str = Field(
|
|
default="http://localhost:8000",
|
|
description="URL for llama-service inference",
|
|
)
|
|
llama_timeout: float = Field(
|
|
default=30.0,
|
|
description="Timeout for LLM requests in seconds",
|
|
)
|
|
|
|
# Scheduler settings
|
|
cycle_interval_seconds: int = Field(
|
|
default=60,
|
|
description="Seconds between commit cycles (default: 1 minute)",
|
|
)
|
|
enabled: bool = Field(
|
|
default=True,
|
|
description="Whether the daemon is enabled on startup",
|
|
)
|
|
|
|
# Repository configuration
|
|
repos_base_path: Path = Field(
|
|
default_factory=Path.cwd,
|
|
description="Primary base path containing repositories to process (defaults to current directory)",
|
|
)
|
|
repos_base_paths: list[Path] = Field(
|
|
default=[],
|
|
description="Additional base paths for recursive discovery (if empty, uses repos_base_path only)",
|
|
)
|
|
repo_names: list[str] = Field(
|
|
default=[],
|
|
description="Names of subdirectories to process as repositories (empty = use recursive discovery)",
|
|
)
|
|
ignore_repos: list[str] = Field(
|
|
default=[],
|
|
description="Repository names to ignore (exclude from processing)",
|
|
)
|
|
|
|
# Persistent commit history
|
|
commit_history_file: Path = Field(
|
|
default=Path("~/.config/commits/commit-history.json").expanduser(),
|
|
description="Persistent commit history file (survives reboots)",
|
|
)
|
|
commit_history_max_per_daemon: int = Field(
|
|
default=20,
|
|
description="Maximum commits to keep per daemon in history",
|
|
)
|
|
|
|
# Recursive discovery settings
|
|
recursive_discovery: bool = Field(
|
|
default=True,
|
|
description="Auto-discover git repos recursively",
|
|
)
|
|
recursive_depth: int | None = Field(
|
|
default=4,
|
|
description="Max depth for recursive discovery (None = unlimited)",
|
|
)
|
|
cache_update_minutes: int = Field(
|
|
default=60,
|
|
description="Minutes between repo cache refreshes",
|
|
)
|
|
exclude_patterns: list[str] = Field(
|
|
default=["node_modules", "pyvenv", ".venv", "venv", "dist", "build", "__pycache__"],
|
|
description="Patterns to exclude from recursive discovery",
|
|
)
|
|
|
|
# Git settings
|
|
git_remote: str = Field(
|
|
default="origin",
|
|
description="Git remote to push to",
|
|
)
|
|
git_branch: str = Field(
|
|
default="master",
|
|
description="Git branch to push to",
|
|
)
|
|
|
|
# Claude fallback settings
|
|
claude_fallback_enabled: bool = Field(
|
|
default=True,
|
|
description="Enable Claude Code fallback for failures",
|
|
)
|
|
claude_timeout_seconds: int = Field(
|
|
default=300,
|
|
description="Timeout for Claude Code execution in seconds",
|
|
)
|
|
|
|
# Llama service management
|
|
llama_service_autostart: bool = Field(
|
|
default=True,
|
|
description="Automatically start llama service if not running",
|
|
)
|
|
llama_service_startup_timeout: float = Field(
|
|
default=30.0,
|
|
description="Timeout for service startup in seconds",
|
|
)
|
|
llama_service_pid_file: Path = Field(
|
|
default=Path("~/.config/commits/llama-service.pid").expanduser(),
|
|
description="PID file for llama service tracking",
|
|
)
|
|
llama_service_lock_file: Path = Field(
|
|
default=Path("~/.config/commits/llama-service.lock").expanduser(),
|
|
description="Lock file for service startup coordination",
|
|
)
|
|
llama_service_health_check_interval: int = Field(
|
|
default=0,
|
|
description="Cycles between health checks (0 = check every cycle)",
|
|
)
|
|
llama_service_max_restart_attempts: int = Field(
|
|
default=3,
|
|
description="Maximum restart attempts before giving up",
|
|
)
|
|
llama_service_restart_backoff_seconds: float = Field(
|
|
default=5.0,
|
|
description="Delay between restart attempts (seconds)",
|
|
)
|
|
|
|
# Model-boss integration for auto-loading LLM
|
|
llama_model_id: str = Field(
|
|
default="qwen2.5-1.5b-instruct",
|
|
description="Model ID for commit message generation (resolved via model-boss)",
|
|
)
|
|
use_model_boss: bool = Field(
|
|
default=True,
|
|
description="Use model-boss to resolve model paths before starting llama-service",
|
|
)
|
|
|
|
# File grouping configuration
|
|
grouping_model: str = Field(
|
|
default="mistral-3-14b",
|
|
description="Model ID for intelligent file grouping (uses Mistral 3 14B reasoning)",
|
|
)
|
|
use_mistral_for_grouping: bool = Field(
|
|
default=True,
|
|
description="Enable Mistral-based file grouping (creates multiple logical commits per repo)",
|
|
)
|
|
max_files_per_commit: int = Field(
|
|
default=15,
|
|
description="Maximum files allowed per commit group",
|
|
)
|
|
min_groups: int = Field(
|
|
default=2,
|
|
description="Minimum number of groups to create when >X files changed (force splitting)",
|
|
)
|
|
|
|
# Logging
|
|
log_file: Path = Field(
|
|
default=Path("/tmp/auto-commit.log"),
|
|
description="Path for service log file",
|
|
)
|
|
activity_log_path: Path | None = Field(
|
|
default=None,
|
|
description="Optional path for commit activity log file",
|
|
)
|
|
|
|
model_config = {"env_prefix": "AUTO_COMMIT_"}
|