
    1bi^                    l    d Z ddlmZ ddlZddlmZ 	 ddlmZ ddlmZ y# e	e
f$ r d	dZd
dZY yw xY w)a  Resolve HERMES_HOME for standalone skill scripts.

Skill scripts may run outside the Hermes process (e.g. system Python,
nix env, CI) where ``hermes_constants`` is not importable.  This module
provides the same ``get_hermes_home()`` and ``display_hermes_home()``
contracts as ``hermes_constants`` without requiring it on ``sys.path``.

When ``hermes_constants`` IS available it is used directly so that any
future enhancements (profile resolution, Docker detection, etc.) are
picked up automatically.  The fallback path replicates the core logic
from ``hermes_constants.py`` using only the stdlib.

All scripts under ``google-workspace/scripts/`` should import from here
instead of duplicating the ``HERMES_HOME = Path(os.getenv(...))`` pattern.
    )annotationsN)Path)display_hermes_home)get_hermes_homec                     t         j                  j                  dd      j                         } | rt	        |       S t	        j
                         dz  S )zoReturn the Hermes home directory (default: ~/.hermes).

        Mirrors ``hermes_constants.get_hermes_home()``.HERMES_HOME z.hermes)osenvirongetstripr   home)vals    J/DATA/.hermes/skills/productivity/google-workspace/scripts/_hermes_home.pyr   r      s=     jjnn]B/557tCy<TYY[9%<<    c                     t               } 	 dt        | j                  t        j                                     z   S # t
        $ r t        |       cY S w xY w)ztReturn a user-friendly ``~/``-shortened display string.

        Mirrors ``hermes_constants.display_hermes_home()``.z~/)r   strrelative_tor   r   
ValueError)r   s    r   r   r   "   sK      	#d..tyy{;<<< 	t9	s   .; AA)returnr   )r   r   )__doc__
__future__r   r
   pathlibr   hermes_constantsr   r   ModuleNotFoundErrorImportError r   r   <module>r      s>     # 	 KC[) =s   ! 33