Compare commits

...

1 Commits

Author SHA1 Message Date
Hermes Agent
929e3da00f fix: expand tilde in get_hermes_home() and get_optional_skills_dir()
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 1m0s
Resolves #478. HERMES_HOME=~/... was returned as a literal path with
~ instead of expanding to the user's home directory. Same issue with
HERMES_OPTIONAL_SKILLS.

Fixes:
- get_hermes_home(): Path(...).expanduser() on the env var value
- get_optional_skills_dir(): Path(override).expanduser()
- Updated docstring to document tilde expansion

This affects any caller that sets HERMES_HOME=~/custom-path in their
.env or shell environment — the tilde was never expanded, causing
FileNotFoundError or creating directories in literal '~/...' paths.
2026-04-13 21:36:35 -04:00

View File

@@ -12,9 +12,10 @@ def get_hermes_home() -> Path:
"""Return the Hermes home directory (default: ~/.hermes).
Reads HERMES_HOME env var, falls back to ~/.hermes.
Expands ~ to the user's home directory.
This is the single source of truth — all other copies should import this.
"""
return Path(os.getenv("HERMES_HOME", Path.home() / ".hermes"))
return Path(os.getenv("HERMES_HOME", str(Path.home() / ".hermes"))).expanduser()
def get_optional_skills_dir(default: Path | None = None) -> Path:
@@ -25,7 +26,7 @@ def get_optional_skills_dir(default: Path | None = None) -> Path:
"""
override = os.getenv("HERMES_OPTIONAL_SKILLS", "").strip()
if override:
return Path(override)
return Path(override).expanduser()
if default is not None:
return default
return get_hermes_home() / "optional-skills"