vibe/vibe/cli/update_notifier/whats_new.py
Mathias Gesbert 702d0f412e
v2.14.1 (#756)
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Gauthier Guinet <43207538+Gguinet@users.noreply.github.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: Stanislas <stanislas.lange@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
2026-06-08 14:59:41 +02:00

45 lines
1.2 KiB
Python

from __future__ import annotations
from dataclasses import replace
import time
from vibe import VIBE_ROOT
from vibe.cli.update_notifier.ports.update_cache_repository import (
UpdateCache,
UpdateCacheRepository,
)
from vibe.core.utils.io import read_safe
async def should_show_whats_new(
current_version: str, repository: UpdateCacheRepository
) -> bool:
cache = await repository.get()
if cache is None:
return False
return cache.seen_whats_new_version != current_version
def load_whats_new_content() -> str | None:
whats_new_file = VIBE_ROOT / "whats_new.md"
if not whats_new_file.exists():
return None
try:
content = read_safe(whats_new_file).text.strip()
return content if content else None
except OSError:
return None
async def mark_version_as_seen(version: str, repository: UpdateCacheRepository) -> None:
cache = await repository.get()
if cache is None:
await repository.set(
UpdateCache(
latest_version=version,
stored_at_timestamp=int(time.time()),
seen_whats_new_version=version,
)
)
return
await repository.set(replace(cache, seen_whats_new_version=version))