"""Helix official CLI.
The ``helix`` console-script (registered in ``pyproject.toml``)
dispatches into :mod:`helix_cli.main`. The CLI is a thin client over the
existing MCP Streamable-HTTP surface and a tiny number of unauthenticated
REST probes (``/api/v1/health`` + ``/api/v1/ready``); it does not embed
business logic and does not bypass the audit/RBAC chain.
Why MCP-first: every mutating user-facing action already ships as an
``@mcp_server.tool(...)`` registration that funnels through the same
service layer the web UI uses (the **MCP-sync rule** in CLAUDE.md). A
CLI command that called REST directly would fork that surface and skip
the audit/permission machinery wired into ``tool_runtime``. By going
through MCP, the CLI inherits — for free — Leaver-Blocked, RBAC,
approval routing, and audit-log writes.
Authentication: PAT only (``helix_pat_…``). The same token that powers
Claude Desktop / Cursor / CI scripts powers the CLI. There is no
second login flow, no service-account model, no JWT-on-MCP relaxation.
"""
from __future__ import annotations
#: Single source of truth for the CLI version. Resolved from the
#: installed package metadata (wheel / pipx / ``pip install -e``); the
#: release build stamps ``+g`` so a deployed artifact
#: reports exactly which commit it came from. PyInstaller binaries get
#: the metadata via ``--copy-metadata helix-cli`` in cli-release.yml.
#: Falls back to a sentinel for an un-packaged source checkout so the
#: version always surfaces (User-Agent + ``helix version``) instead of
#: crashing.
try:
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as _pkg_version
try:
__version__ = _pkg_version("helix-cli")
except PackageNotFoundError:
__version__ = "0.0.0+source"
except Exception: # pragma: no cover
__version__ = "0.0.0+source"
__all__ = ["__version__"]