scripts/_hermes_home.py
scripts/_hermes_home.pyBrowse 5 files
194 tokens
836 bytes
Token encoding: o200k_base
Snapshot 24fd22b
← Back to SKILL.md
1"""Resolve HERMES_HOME for standalone skill scripts.2 3Skill scripts may run outside the Hermes process (system Python, nix env,4CI) where ``hermes_constants`` is not importable. This module provides the5same ``get_hermes_home()`` contract without requiring it on ``sys.path``.6 7When ``hermes_constants`` IS available it is used directly so profile8resolution and any future enhancements are picked up automatically.9"""10 11from __future__ import annotations12 13import os14from pathlib import Path15 16try:17 from hermes_constants import get_hermes_home as get_hermes_home18except (ModuleNotFoundError, ImportError):19 20 def get_hermes_home() -> Path:21 """Return the Hermes home directory (default: ``~/.hermes``)."""22 val = os.environ.get("HERMES_HOME", "").strip()23 return Path(val) if val else Path.home() / ".hermes"24