Compare commits

...

1 Commits

Author SHA1 Message Date
Timmy
9930d25786 fix: remove hardcoded ~/.hermes paths from optional skills (#499)
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 1m12s
telephony.py _hermes_home() used "~/.hermes" as default instead of
str(Path.home() / ".hermes"). Fixed. memento_cards.py and canvas_api.py
were already correct (Path.home() or docs-only references).

Closes #479.
2026-04-13 21:44:02 -04:00
3 changed files with 44 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ class OwnedTwilioNumber:
def _hermes_home() -> Path:
return Path(os.environ.get("HERMES_HOME", "~/.hermes")).expanduser()
return Path(os.environ.get("HERMES_HOME", str(Path.home() / ".hermes")))
def _env_path() -> Path:

View File

View File

@@ -0,0 +1,43 @@
"""Tests for hardcoded path fixes in optional skills."""
import subprocess
import sys
from pathlib import Path
import pytest
@pytest.fixture
def hermes_agent_root():
return Path(__file__).parent.parent.parent
class TestNoHardcodedPaths:
def test_telephony_no_tilde_default(self, hermes_agent_root):
"""telephony.py should not use ~/.hermes as a default path."""
telephony = hermes_agent_root / "optional-skills/productivity/telephony/scripts/telephony.py"
content = telephony.read_text()
# The _hermes_home function should not use ~/
lines = content.split("\n")
for line in lines:
if "_hermes_home" in line and "def " not in line:
assert '"~/.hermes"' not in line, f"Hardcoded ~/.hermes found in telephony.py: {line.strip()}"
def test_memento_uses_path_home(self, hermes_agent_root):
"""memento_cards.py should use Path.home() not hardcoded paths."""
memento = hermes_agent_root / "optional-skills/productivity/memento-flashcards/scripts/memento_cards.py"
content = memento.read_text()
assert "Path.home()" in content, "memento_cards.py should use Path.home()"
def test_canvas_no_hardcoded_home(self, hermes_agent_root):
"""canvas_api.py docstrings are OK, but code should not hardcode paths."""
canvas = hermes_agent_root / "optional-skills/productivity/canvas/scripts/canvas_api.py"
content = canvas.read_text()
# Check that there's no code (non-docstring) using ~/.hermes as a path
lines = content.split("\n")
for line in lines:
stripped = line.strip()
if stripped.startswith("#") or stripped.startswith('"'):
continue # comments and strings are OK
if "~/.hermes" in stripped and ("Path(" in stripped or "os.path" in stripped):
pytest.fail(f"Hardcoded ~/.hermes path in code: {stripped}")