Co-authored-by: Quentin Torroba <quentin.torroba@mistral.ai>
Co-authored-by: Clement Sirieix <clem.sirieix@gmail.com>
Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-03-10 16:07:18 +01:00 committed by GitHub
parent dd372ce494
commit e9428bce23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 877 additions and 362 deletions

View file

@ -0,0 +1,31 @@
from __future__ import annotations
from vibe.core.paths._local_config_walk import walk_local_config_dirs_all
from vibe.core.paths._vibe_home import (
DEFAULT_TOOL_DIR,
GLOBAL_ENV_FILE,
HISTORY_FILE,
LOG_DIR,
LOG_FILE,
PLANS_DIR,
SESSION_LOG_DIR,
TRUSTED_FOLDERS_FILE,
VIBE_HOME,
GlobalPath,
)
from vibe.core.paths.conventions import AGENTS_MD_FILENAMES
__all__ = [
"AGENTS_MD_FILENAMES",
"DEFAULT_TOOL_DIR",
"GLOBAL_ENV_FILE",
"HISTORY_FILE",
"LOG_DIR",
"LOG_FILE",
"PLANS_DIR",
"SESSION_LOG_DIR",
"TRUSTED_FOLDERS_FILE",
"VIBE_HOME",
"GlobalPath",
"walk_local_config_dirs_all",
]

View file

@ -26,16 +26,12 @@ def _get_vibe_home() -> Path:
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")
GLOBAL_AGENTS_DIR = GlobalPath(lambda: VIBE_HOME.path / "agents")
GLOBAL_PROMPTS_DIR = GlobalPath(lambda: VIBE_HOME.path / "prompts")
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 / "logs" / "vibe.log")
HISTORY_FILE = GlobalPath(lambda: VIBE_HOME.path / "vibehistory")
PLANS_DIR = GlobalPath(lambda: VIBE_HOME.path / "plans")
DEFAULT_TOOL_DIR = GlobalPath(lambda: VIBE_ROOT / "core" / "tools" / "builtins")

View file

@ -1,63 +0,0 @@
from __future__ import annotations
from pathlib import Path
from typing import Literal
from vibe.core.paths.global_paths import VIBE_HOME, GlobalPath
from vibe.core.paths.local_config_walk import walk_local_config_dirs_all
from vibe.core.trusted_folders import trusted_folders_manager
_config_paths_locked: bool = True
class ConfigPath(GlobalPath):
@property
def path(self) -> Path:
if _config_paths_locked:
raise RuntimeError("Config path is locked")
return super().path
def _resolve_config_path(basename: str, type: Literal["file", "dir"]) -> Path:
cwd = Path.cwd()
is_folder_trusted = trusted_folders_manager.is_trusted(cwd)
if not is_folder_trusted:
return VIBE_HOME.path / basename
if type == "file":
if (candidate := cwd / ".vibe" / basename).is_file():
return candidate
elif type == "dir":
if (candidate := cwd / ".vibe" / basename).is_dir():
return candidate
return VIBE_HOME.path / basename
def _discover_local_config_dirs_all(
root: Path,
) -> tuple[tuple[Path, ...], tuple[Path, ...], tuple[Path, ...]]:
if not trusted_folders_manager.is_trusted(root):
return ((), (), ())
return walk_local_config_dirs_all(root)
def discover_local_tools_dirs(root: Path) -> list[Path]:
return list(_discover_local_config_dirs_all(root)[0])
def discover_local_skills_dirs(root: Path) -> list[Path]:
return list(_discover_local_config_dirs_all(root)[1])
def discover_local_agents_dirs(root: Path) -> list[Path]:
return list(_discover_local_config_dirs_all(root)[2])
def unlock_config_paths() -> None:
global _config_paths_locked
_config_paths_locked = False
CONFIG_FILE = ConfigPath(lambda: _resolve_config_path("config.toml", "file"))
CONFIG_DIR = ConfigPath(lambda: CONFIG_FILE.path.parent)
PROMPTS_DIR = ConfigPath(lambda: _resolve_config_path("prompts", "dir"))
HISTORY_FILE = ConfigPath(lambda: _resolve_config_path("vibehistory", "file"))

View file

@ -0,0 +1,3 @@
from __future__ import annotations
AGENTS_MD_FILENAMES = ["AGENTS.md", "VIBE.md", ".vibe.md"]