fix(xiaoyuzhou): correct groq-api-key→groq-key in doctor hint and fix check() reading config after configure (#129)

Fixes #128

Two bugs:
1. doctor warn message said 'agent-reach configure groq-api-key' but the
   actual CLI arg is 'groq-key' (see cli.py:75 choices list and :993 handler).
   Same typo existed in cli.py _install_xiaoyuzhou_deps() output.

2. check() had a logic flaw: the inner 'if not has_key' was nested inside
   'if not os.environ.get(...)', so when GROQ_API_KEY env var was absent but
   config.json read succeeded, the outer condition never triggered the warning.
   Refactored to a flat has_key variable — cleaner and correct.

Verified: 36/36 tests pass, manual unit tests confirm warn uses 'groq-key'
and ok is returned when groq_api_key is present in config.json.

Co-authored-by: 小白(Agent) <neo@agent-reach.dev>
This commit is contained in:
Pnant 2026-03-09 18:18:15 +08:00 committed by GitHub
parent 6ddcfe2b57
commit f3daa5cf97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 11 deletions

View file

@ -503,7 +503,7 @@ def _install_xiaoyuzhou_deps():
print(" ✅ Groq API key configured")
else:
print(" -- Groq API key not set. Get free key at https://console.groq.com")
print(" Then run: agent-reach configure groq-api-key gsk_xxxxx")
print(" Then run: agent-reach configure groq-key gsk_xxxxx")
def _install_weibo_deps():