v2.10.1 (#702)
Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
228f3c65a9
commit
f71bfd3b8c
57 changed files with 2950 additions and 402 deletions
32
vibe/core/config/layers/user.py
Normal file
32
vibe/core/config/layers/user.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
import tomllib
|
||||
from typing import Any
|
||||
|
||||
from vibe.core.config.layer import ConfigLayer, RawConfig
|
||||
from vibe.core.paths._vibe_home import VIBE_HOME
|
||||
|
||||
|
||||
class UserConfigLayer(ConfigLayer[RawConfig]):
|
||||
"""Reads the user-level TOML config file. Always trusted.
|
||||
|
||||
Defaults to ``~/.vibe/config.toml`` (via VIBE_HOME).
|
||||
Pass an explicit ``path`` for testing.
|
||||
"""
|
||||
|
||||
def __init__(self, *, path: Path | None = None, name: str = "user-toml") -> None:
|
||||
super().__init__(name=name)
|
||||
self._path = path or (VIBE_HOME.path / "config.toml")
|
||||
|
||||
async def _check_trust(self) -> bool:
|
||||
return True
|
||||
|
||||
async def _read_config(self) -> dict[str, Any]:
|
||||
if not self._path.exists():
|
||||
return {}
|
||||
with self._path.open("rb") as f:
|
||||
return tomllib.load(f)
|
||||
|
||||
async def apply(self, patch: Any, *, on_conflict: str = "cancel") -> None:
|
||||
raise NotImplementedError("UserConfigLayer.apply() is not implemented (M2)")
|
||||
Loading…
Add table
Add a link
Reference in a new issue