fix(platforms): clear home channel when setup prompt left blank

Blank (or whitespace-only) answers to the home-channel prompt in the
interactive setup wizards previously left any previously saved
*_HOME_CHANNEL / *_HOME_ROOM env value in place, so operators could not
clear a stale home channel by re-running setup. Strip the prompt input
and call remove_env_value() on blank answers across the Discord, Slack,
Feishu, Matrix, Mattermost, WeCom and WhatsApp plugin setup wizards,
with per-adapter wizard tests covering set/clear/whitespace flows.

Squash of the three commits from PR #58421 (setup-wizard fix, matrix/
wecom extension, and 6-adapter test coverage) — one commit per
contributor on this salvage branch.

Fixes #12423
Salvaged from #58421
This commit is contained in:
David Metcalfe 2026-07-23 08:03:20 -07:00 committed by Teknium
parent ee62aab1a7
commit 241bc112e8
14 changed files with 696 additions and 35 deletions

View file

@ -5520,7 +5520,7 @@ def interactive_setup() -> None:
Replaces the central _setup_feishu in hermes_cli/gateway.py and the static
_PLATFORMS["feishu"] dict. CLI helpers are lazy-imported.
"""
from hermes_cli.config import get_env_value, save_env_value
from hermes_cli.config import get_env_value, remove_env_value, save_env_value
from hermes_cli.setup import prompt_choice
from hermes_cli.cli_output import (
prompt,
@ -5671,10 +5671,17 @@ def interactive_setup() -> None:
save_env_value("FEISHU_GROUP_POLICY", "disabled")
print_info("Group chats disabled.")
home_channel = prompt("Home chat ID (optional, for cron/notifications)", password=False)
print_info(
"Leave blank to clear a previously saved home channel "
"(cron / notifications)."
)
home_channel = prompt("Home chat ID (optional, for cron/notifications)", password=False).strip()
if home_channel:
save_env_value("FEISHU_HOME_CHANNEL", home_channel)
print_success(f"Home channel set to {home_channel}")
else:
if remove_env_value("FEISHU_HOME_CHANNEL"):
print_info("Home channel cleared.")
print_success("🪽 Feishu / Lark configured!")
print_info(f"App ID: {app_id}")