shared_profile_warning.py 998 B

123456789101112131415161718192021222324
  1. """Advisory only: simultaneous installs share profile data, not ownership."""
  2. from __future__ import annotations
  3. from pathlib import Path
  4. from hermes_cli.process_identity import install_id, ledger_entries
  5. from hermes_constants import hermes_home_key
  6. def shared_profile_warning(*, home: Path | None = None, project_root: Path | None = None) -> str:
  7. """An old stamp or a profile name alone cannot prove concurrent use."""
  8. own_install = install_id(project_root)
  9. home_key = hermes_home_key(home)
  10. if any(
  11. entry.get("install") and entry["install"] != own_install
  12. and entry.get("hermes_home") == home_key
  13. for entry in ledger_entries(all_installs=True, verified_only=True)
  14. ):
  15. return (
  16. "Another Hermes installation is using this profile. Both installations share "
  17. "its settings and data, so changes can conflict. You can continue, or close "
  18. "the other installation before making changes."
  19. )
  20. return ""