fix(plugins): widen masked secret prompt to plugin setup wizards

Extend PR #31716 to plugin setup paths that were also using bare
getpass.getpass(): hindsight (4 sites), honcho, simplex, line. Same
mechanical swap onto hermes_cli.secret_prompt.masked_secret_prompt.
This commit is contained in:
Teknium 2026-05-24 23:05:41 -07:00
parent ec4d6f1823
commit 9c77a0c3ce
4 changed files with 11 additions and 11 deletions

View file

@ -629,13 +629,13 @@ class HindsightMemoryProvider(MemoryProvider):
def post_setup(self, hermes_home: str, config: dict) -> None:
"""Custom setup wizard — installs only the deps needed for the selected mode."""
import getpass
import subprocess
import shutil
import sys
from pathlib import Path
from hermes_cli.config import save_config
from hermes_cli.secret_prompt import masked_secret_prompt
from hermes_cli.memory_setup import _curses_select
@ -696,11 +696,11 @@ class HindsightMemoryProvider(MemoryProvider):
masked = f"...{existing_key[-4:]}" if len(existing_key) > 4 else "set"
sys.stdout.write(f" API key (current: {masked}, blank to keep): ")
sys.stdout.flush()
api_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip()
api_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip()
else:
sys.stdout.write(" API key: ")
sys.stdout.flush()
api_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip()
api_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip()
if api_key:
env_writes["HINDSIGHT_API_KEY"] = api_key
@ -714,7 +714,7 @@ class HindsightMemoryProvider(MemoryProvider):
sys.stdout.write(" API key (optional, blank to skip): ")
sys.stdout.flush()
api_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip()
api_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip()
if api_key:
env_writes["HINDSIGHT_API_KEY"] = api_key
@ -750,7 +750,7 @@ class HindsightMemoryProvider(MemoryProvider):
sys.stdout.write(" LLM API key: ")
sys.stdout.flush()
llm_key = getpass.getpass(prompt="") if sys.stdin.isatty() else sys.stdin.readline().strip()
llm_key = masked_secret_prompt("") if sys.stdin.isatty() else sys.stdin.readline().strip()
if llm_key:
env_writes["HINDSIGHT_LLM_API_KEY"] = llm_key
else:

View file

@ -314,8 +314,8 @@ def _prompt(label: str, default: str | None = None, secret: bool = False) -> str
sys.stdout.flush()
if secret:
if sys.stdin.isatty():
import getpass
val = getpass.getpass(prompt="")
from hermes_cli.secret_prompt import masked_secret_prompt
val = masked_secret_prompt("")
else:
# Non-TTY (piped input, test runners) — read plaintext
val = sys.stdin.readline().strip()

View file

@ -1585,8 +1585,8 @@ def interactive_setup() -> None:
suffix = " [keep current]" if existing else ""
try:
if secret:
import getpass
value = getpass.getpass(f"{prompt}{suffix}: ")
from hermes_cli.secret_prompt import masked_secret_prompt
value = masked_secret_prompt(f"{prompt}{suffix}: ")
else:
value = input(f"{prompt}{suffix}: ").strip()
except (EOFError, KeyboardInterrupt):

View file

@ -685,8 +685,8 @@ def interactive_setup() -> None:
suffix = " [keep current]" if existing else ""
try:
if secret:
import getpass
value = getpass.getpass(f"{prompt}{suffix}: ")
from hermes_cli.secret_prompt import masked_secret_prompt
value = masked_secret_prompt(f"{prompt}{suffix}: ")
else:
value = input(f"{prompt}{suffix}: ").strip()
except (EOFError, KeyboardInterrupt):