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

@ -8729,7 +8729,7 @@ def interactive_setup() -> None:
offers to set a home channel. Replaces ``hermes_cli/setup.py::_setup_slack``.
"""
from pathlib import Path
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.cli_output import (
prompt,
prompt_yes_no,
@ -8831,9 +8831,12 @@ def interactive_setup() -> None:
print_info(" To get a channel ID: open the channel in Slack, then right-click")
print_info(" the channel name → Copy link — the ID starts with C (e.g. C01ABC2DE3F).")
print_info(" You can also set this later by typing /set-home in a Slack channel.")
home_channel = prompt("Home channel ID (leave empty to set later with /set-home)")
home_channel = prompt("Home channel ID (leave empty to set later with /set-home)").strip()
if home_channel:
save_env_value("SLACK_HOME_CHANNEL", home_channel.strip())
save_env_value("SLACK_HOME_CHANNEL", home_channel)
else:
if remove_env_value("SLACK_HOME_CHANNEL"):
print_info("Home channel cleared.")
def _apply_yaml_config(yaml_cfg: dict, slack_cfg: dict) -> dict | None: