refactor: optimize onboard wizard - mask secrets, remove emoji, reduce repetition
- Mask sensitive fields (api_key/token/secret/password) in all display surfaces, showing only the last 4 characters - Replace all emoji with pure ASCII labels for consistent cross-platform terminal rendering - Extract _print_summary_panel helper, eliminating 5x duplicate table construction in _show_summary - Replace 3 one-line wrapper functions with declarative _SETTINGS_SECTIONS dispatch tables and _MENU_DISPATCH in run_onboard - Extract _handle_model_field / _handle_context_window_field into a _FIELD_HANDLERS registry, shrinking _configure_pydantic_model - Return FieldTypeInfo NamedTuple from _get_field_type_info for clarity - Replace global mutable _PROVIDER_INFO / _CHANNEL_INFO with @lru_cache - Use vars() instead of dir() in _get_channel_info for reliable config class discovery - Defer litellm import in model_info.py so non-wizard CLI paths stay fast - Clarify README Quick Start wording (Add -> Configure)
This commit is contained in:
@@ -401,7 +401,7 @@ class TestConfigurePydanticModelDrafts:
|
||||
if token == "first":
|
||||
return choices[0]
|
||||
if token == "done":
|
||||
return "✓ Done"
|
||||
return "[Done]"
|
||||
if token == "back":
|
||||
return _BACK_PRESSED
|
||||
return token
|
||||
@@ -461,9 +461,9 @@ class TestRunOnboardExitBehavior:
|
||||
|
||||
responses = iter(
|
||||
[
|
||||
"🤖 Configure Agent Settings",
|
||||
"[A] Agent Settings",
|
||||
KeyboardInterrupt(),
|
||||
"🗑️ Exit Without Saving",
|
||||
"[X] Exit Without Saving",
|
||||
]
|
||||
)
|
||||
|
||||
@@ -479,12 +479,13 @@ class TestRunOnboardExitBehavior:
|
||||
def fake_select(*_args, **_kwargs):
|
||||
return FakePrompt(next(responses))
|
||||
|
||||
def fake_configure_agents(config):
|
||||
config.agents.defaults.model = "test/provider-model"
|
||||
def fake_configure_general_settings(config, section):
|
||||
if section == "Agent Settings":
|
||||
config.agents.defaults.model = "test/provider-model"
|
||||
|
||||
monkeypatch.setattr(onboard_wizard, "_show_main_menu_header", lambda: None)
|
||||
monkeypatch.setattr(onboard_wizard.questionary, "select", fake_select)
|
||||
monkeypatch.setattr(onboard_wizard, "_configure_agents", fake_configure_agents)
|
||||
monkeypatch.setattr(onboard_wizard, "questionary", SimpleNamespace(select=fake_select))
|
||||
monkeypatch.setattr(onboard_wizard, "_configure_general_settings", fake_configure_general_settings)
|
||||
|
||||
result = run_onboard(initial_config=initial_config)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user