sync: auto-sync from GURU-BEAST-ROG at 2026-05-01 15:05:53
Author: Mike Swanson Machine: GURU-BEAST-ROG Timestamp: 2026-05-01 15:05:53
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Configuration management for ClaudeTools Discord Bot."""
|
||||
"""Configuration for the ClaudeTools Discord Bot."""
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
@@ -7,76 +7,43 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Bot configuration from environment variables."""
|
||||
|
||||
# Discord
|
||||
discord_token: str = Field(..., description="Discord bot token")
|
||||
discord_guild_id: Optional[int] = Field(None, description="Discord guild/server ID")
|
||||
|
||||
# Anthropic Claude API
|
||||
anthropic_api_key: str = Field(..., description="Anthropic API key")
|
||||
claude_model: str = Field(
|
||||
default="claude-sonnet-4-5-20250929",
|
||||
description="Claude model to use"
|
||||
)
|
||||
# Optional: leave unset to use the local Claude Code OAuth credential
|
||||
# (Pro/Max subscription). Set to use the API with metered billing.
|
||||
anthropic_api_key: Optional[str] = Field(default=None, description="Anthropic API key")
|
||||
claude_model: str = Field(default="claude-sonnet-4-6", description="Claude model")
|
||||
|
||||
# ClaudeTools API
|
||||
claudetools_api_url: str = Field(
|
||||
default="http://172.16.3.30:8001",
|
||||
description="ClaudeTools API base URL"
|
||||
)
|
||||
claudetools_api_key: str = Field(..., description="ClaudeTools API key")
|
||||
|
||||
# File Paths
|
||||
vault_path: Path = Field(
|
||||
default=Path("D:/vault"),
|
||||
description="Path to SOPS vault"
|
||||
)
|
||||
# Workspace the agent operates in. Default is the Windows BEAST path; override
|
||||
# via CLAUDETOOLS_ROOT env var on Mac/Linux.
|
||||
claudetools_root: Path = Field(
|
||||
default=Path("D:/claudetools"),
|
||||
description="Path to ClaudeTools repository"
|
||||
default=Path("c:/Users/guru/ClaudeTools"),
|
||||
description="Path to ClaudeTools repository (agent cwd)",
|
||||
)
|
||||
|
||||
# Git Bash (for remediation scripts on Windows)
|
||||
git_bash_path: Path = Field(
|
||||
default=Path("C:/Program Files/Git/bin/bash.exe"),
|
||||
description="Path to Git Bash executable"
|
||||
)
|
||||
|
||||
# Logging
|
||||
log_level: str = Field(default="INFO", description="Logging level")
|
||||
log_file: Optional[Path] = Field(
|
||||
default=Path("logs/bot.log"),
|
||||
description="Log file path"
|
||||
)
|
||||
log_file: Optional[Path] = Field(default=Path("logs/bot.log"), description="Log file")
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env",
|
||||
env_file_encoding="utf-8",
|
||||
case_sensitive=False,
|
||||
extra="ignore"
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
def validate_paths(self) -> None:
|
||||
"""Validate that required paths exist."""
|
||||
if not self.git_bash_path.exists():
|
||||
raise FileNotFoundError(
|
||||
f"Git Bash not found at {self.git_bash_path}. "
|
||||
"Set GIT_BASH_PATH environment variable."
|
||||
)
|
||||
|
||||
if not self.vault_path.exists():
|
||||
raise FileNotFoundError(
|
||||
f"Vault not found at {self.vault_path}. "
|
||||
"Set VAULT_PATH environment variable."
|
||||
)
|
||||
|
||||
if not self.claudetools_root.exists():
|
||||
raise FileNotFoundError(
|
||||
f"ClaudeTools not found at {self.claudetools_root}. "
|
||||
"Set CLAUDETOOLS_ROOT environment variable."
|
||||
)
|
||||
claude_md = self.claudetools_root / ".claude" / "CLAUDE.md"
|
||||
if not claude_md.exists():
|
||||
raise FileNotFoundError(
|
||||
f"CLAUDE.md not found at {claude_md}. "
|
||||
"Agent system prompt cannot be loaded."
|
||||
)
|
||||
|
||||
|
||||
# Global settings instance
|
||||
settings = Settings()
|
||||
|
||||
Reference in New Issue
Block a user