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: def post_setup(self, hermes_home: str, config: dict) -> None:
"""Custom setup wizard — installs only the deps needed for the selected mode.""" """Custom setup wizard — installs only the deps needed for the selected mode."""
import getpass
import subprocess import subprocess
import shutil import shutil
import sys import sys
from pathlib import Path from pathlib import Path
from hermes_cli.config import save_config from hermes_cli.config import save_config
from hermes_cli.secret_prompt import masked_secret_prompt
from hermes_cli.memory_setup import _curses_select 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" 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.write(f" API key (current: {masked}, blank to keep): ")
sys.stdout.flush() 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: else:
sys.stdout.write(" API key: ") sys.stdout.write(" API key: ")
sys.stdout.flush() 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: if api_key:
env_writes["HINDSIGHT_API_KEY"] = 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.write(" API key (optional, blank to skip): ")
sys.stdout.flush() 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: if api_key:
env_writes["HINDSIGHT_API_KEY"] = api_key env_writes["HINDSIGHT_API_KEY"] = api_key
@ -750,7 +750,7 @@ class HindsightMemoryProvider(MemoryProvider):
sys.stdout.write(" LLM API key: ") sys.stdout.write(" LLM API key: ")
sys.stdout.flush() 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: if llm_key:
env_writes["HINDSIGHT_LLM_API_KEY"] = llm_key env_writes["HINDSIGHT_LLM_API_KEY"] = llm_key
else: else:

View File

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

View File

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

View File

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