mirror of
https://github.com/mistralai/mistral-vibe
synced 2026-04-25 17:14:55 +02:00
Co-authored-by: Bastien <bastien.baret@gmail.com> Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Julien Legrand <72564015+JulienLGRD@users.noreply.github.com> Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Quentin <quentin.torroba@mistral.ai> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
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,
|
|
)
|
|
)
|
|
else:
|
|
await repository.set(
|
|
UpdateCache(
|
|
latest_version=cache.latest_version,
|
|
stored_at_timestamp=cache.stored_at_timestamp,
|
|
seen_whats_new_version=version,
|
|
)
|
|
)
|