vibe/vibe/core/paths/global_paths.py
Mathias Gesbert 078693fc64 v1.3.0
Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai>
Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai>
Co-Authored-By: Clément Drouin <clement.drouin@mistral.ai>
Co-Authored-by: Thiago Padilha <thiago@coplane.com>
2025-12-23 19:11:27 +01:00

38 lines
1.2 KiB
Python

from __future__ import annotations
from collections.abc import Callable
import os
from pathlib import Path
from vibe import VIBE_ROOT
class GlobalPath:
def __init__(self, resolver: Callable[[], Path]) -> None:
self._resolver = resolver
@property
def path(self) -> Path:
return self._resolver()
_DEFAULT_VIBE_HOME = Path.home() / ".vibe"
def _get_vibe_home() -> Path:
if vibe_home := os.getenv("VIBE_HOME"):
return Path(vibe_home).expanduser().resolve()
return _DEFAULT_VIBE_HOME
VIBE_HOME = GlobalPath(_get_vibe_home)
GLOBAL_CONFIG_FILE = GlobalPath(lambda: VIBE_HOME.path / "config.toml")
GLOBAL_ENV_FILE = GlobalPath(lambda: VIBE_HOME.path / ".env")
GLOBAL_TOOLS_DIR = GlobalPath(lambda: VIBE_HOME.path / "tools")
GLOBAL_SKILLS_DIR = GlobalPath(lambda: VIBE_HOME.path / "skills")
SESSION_LOG_DIR = GlobalPath(lambda: VIBE_HOME.path / "logs" / "session")
TRUSTED_FOLDERS_FILE = GlobalPath(lambda: VIBE_HOME.path / "trusted_folders.toml")
LOG_DIR = GlobalPath(lambda: VIBE_HOME.path / "logs")
LOG_FILE = GlobalPath(lambda: VIBE_HOME.path / "vibe.log")
DEFAULT_TOOL_DIR = GlobalPath(lambda: VIBE_ROOT / "core" / "tools" / "builtins")