fix(pets): cover the pets CLI (doctor, has-active, /pet toggle) too

Second review follow-up: hermes_cli/pets.py still read display.pet.enabled
with bare bool()/truthiness in _cmd_doctor (misreported quoted 'false' as
enabled in 'hermes pets doctor'), _has_active_pet (quoted 'false' treated
as active, so /pet install skipped the selection prompt), and
toggle_pet_display (/pet toggle flipped the WRONG way). All three now go
through is_truthy_value(default=False); the module imports the shared
helper at the top.
This commit is contained in:
thatssoheil
2026-08-07 18:54:27 -04:00
committed by Teknium
parent 343068eb10
commit ce02f0ab8a

View File

@@ -13,6 +13,8 @@ from __future__ import annotations
import argparse
import sys
from utils import is_truthy_value
def _print(msg: str = "") -> None:
print(msg)
@@ -249,7 +251,7 @@ def _cmd_doctor(args) -> int:
from agent.pet.render import detect_terminal_graphics, resolve_mode
cfg = _pet_config()
enabled = bool(cfg.get("enabled"))
enabled = is_truthy_value(cfg.get("enabled"), default=False)
configured_slug = str(cfg.get("slug", "") or "")
mode_cfg = str(cfg.get("render_mode", "auto") or "auto")
@@ -300,7 +302,9 @@ def _pet_config() -> dict:
def _has_active_pet() -> bool:
return bool(_pet_config().get("enabled")) and bool(_pet_config().get("slug"))
return is_truthy_value(_pet_config().get("enabled"), default=False) and bool(
_pet_config().get("slug")
)
def _set_active(slug: str) -> None:
@@ -364,7 +368,7 @@ def toggle_pet_display() -> tuple[bool, str | None, str | None]:
slug = str(cfg.get("slug", "") or "")
pet = store.resolve_active_pet(slug)
if bool(cfg.get("enabled")):
if is_truthy_value(cfg.get("enabled"), default=False):
_set_enabled(False)
return False, pet.display_name if pet else None, None