File size: 901 Bytes
7fd88a5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | """Single source of truth for the agent version.
Every script, ``app.py``, the manifest generator and the tests read the version
from the ``VERSION`` file at the package root instead of hard-coding it.
v14 audit finding F-02 (incoherent version identity) recurred in v15 because the
value was copied by hand into several files; centralising it here removes the
class of error rather than detecting it after the fact.
"""
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
VERSION_FILE = ROOT / "VERSION"
def read_version() -> str:
"""Return the agent version declared in ``VERSION`` (e.g. ``16.0.0``)."""
return VERSION_FILE.read_text(encoding="utf-8").strip()
def major_label() -> str:
"""Return the short label used in banners, e.g. ``v16``."""
return "v" + read_version().split(".")[0]
AGENT_VERSION = read_version()
|