60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
"""Configuration module — loads settings from .env file or environment variables."""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
from dotenv import load_dotenv
|
|
|
|
# Load .env from project root
|
|
load_dotenv(Path(__file__).parent / ".env")
|
|
|
|
|
|
class Config:
|
|
"""Bridge configuration."""
|
|
|
|
# Discord
|
|
DISCORD_TOKEN: str = os.getenv("DISCORD_TOKEN", "")
|
|
DISCORD_GUILD_ID: int = int(os.getenv("DISCORD_GUILD_ID") or "0")
|
|
|
|
# Antigravity Brain path
|
|
BRAIN_PATH: Path = Path(os.getenv(
|
|
"BRAIN_PATH",
|
|
os.path.expanduser("~/.gemini/antigravity/brain")
|
|
))
|
|
|
|
# Session activity detection
|
|
ACTIVE_TIMEOUT_SECONDS: int = int(os.getenv("ACTIVE_TIMEOUT_SECONDS", "300"))
|
|
|
|
# Watcher settings
|
|
DEBOUNCE_SECONDS: float = float(os.getenv("DEBOUNCE_SECONDS", "2"))
|
|
|
|
# Files to monitor within each conversation directory
|
|
WATCHED_FILES: set = {
|
|
"task.md",
|
|
"implementation_plan.md",
|
|
"walkthrough.md",
|
|
}
|
|
|
|
# Also monitor these patterns (matched by suffix)
|
|
WATCHED_SUFFIXES: set = {
|
|
".metadata.json", # artifact summary changes
|
|
}
|
|
|
|
# Discord message limits
|
|
DISCORD_MSG_LIMIT: int = 2000
|
|
DISCORD_EMBED_DESC_LIMIT: int = 4096
|
|
|
|
# Channel naming
|
|
CHANNEL_PREFIX: str = "AG"
|
|
|
|
@classmethod
|
|
def validate(cls) -> list[str]:
|
|
"""Return list of configuration errors."""
|
|
errors = []
|
|
if not cls.DISCORD_TOKEN:
|
|
errors.append("DISCORD_TOKEN is not set")
|
|
if not cls.DISCORD_GUILD_ID:
|
|
errors.append("DISCORD_GUILD_ID is not set")
|
|
if not cls.BRAIN_PATH.exists():
|
|
errors.append(f"BRAIN_PATH does not exist: {cls.BRAIN_PATH}")
|
|
return errors
|