fix(setup): use explicit key mapping for returning-user menu dispatch instead of positional index (#3083)

Co-authored-by: ygd58 <buraysandro9@gmail.com>
This commit is contained in:
Teknium
2026-03-25 17:14:43 -07:00
committed by GitHub
parent 9783c9d5c1
commit 0d7f739675

View File

@@ -3234,12 +3234,17 @@ def run_setup_wizard(args):
print_info("Exiting. Run 'hermes setup' again when ready.")
return
elif 3 <= choice <= 7:
# Individual section
section_idx = choice - 3
_, label, func = SETUP_SECTIONS[section_idx]
func(config)
save_config(config)
_print_setup_summary(config, hermes_home)
# Individual section — map by key, not by position.
# SETUP_SECTIONS includes TTS but the returning-user menu skips it,
# so positional indexing (choice - 3) would dispatch the wrong section.
_RETURNING_USER_SECTION_KEYS = ["model", "terminal", "gateway", "tools", "agent"]
section_key = _RETURNING_USER_SECTION_KEYS[choice - 3]
section = next((s for s in SETUP_SECTIONS if s[0] == section_key), None)
if section:
_, label, func = section
func(config)
save_config(config)
_print_setup_summary(config, hermes_home)
return
else:
# ── First-Time Setup ──