fix(cli): point onboarding to the WebUI launcher (#4938)
This commit is contained in:
+5
-17
@@ -643,6 +643,7 @@ def onboard(
|
||||
from nanobot.config.loader import get_config_path, load_config, save_config, set_config_path
|
||||
from nanobot.config.schema import Config
|
||||
|
||||
explicit_config = config is not None
|
||||
if config:
|
||||
config_path = Path(config).expanduser().resolve()
|
||||
set_config_path(config_path)
|
||||
@@ -716,24 +717,11 @@ def onboard(
|
||||
|
||||
sync_workspace_templates(workspace_path)
|
||||
|
||||
agent_cmd = 'nanobot agent -m "Hello!"'
|
||||
gateway_cmd = "nanobot gateway"
|
||||
if config:
|
||||
agent_cmd += f" --config {config_path}"
|
||||
gateway_cmd += f" --config {config_path}"
|
||||
webui_cmd = "nanobot webui"
|
||||
if explicit_config:
|
||||
webui_cmd += f' -c "{config_path}"'
|
||||
|
||||
console.print(f"\n{__logo__} nanobot is ready!")
|
||||
console.print("\nNext steps:")
|
||||
if wizard:
|
||||
console.print(f" 1. Chat: [cyan]{agent_cmd}[/cyan]")
|
||||
console.print(f" 2. Start gateway: [cyan]{gateway_cmd}[/cyan]")
|
||||
else:
|
||||
console.print(f" 1. Add your API key to [cyan]{config_path}[/cyan]")
|
||||
console.print(" Get one at: https://openrouter.ai/keys")
|
||||
console.print(f" 2. Chat: [cyan]{agent_cmd}[/cyan]")
|
||||
console.print(
|
||||
"\n[dim]Want Telegram/WhatsApp? See: https://github.com/HKUDS/nanobot#-chat-apps[/dim]"
|
||||
)
|
||||
typer.echo(f"\n✓ nanobot is ready. Run: {webui_cmd}")
|
||||
|
||||
|
||||
def _onboard_plugins(config_path: Path) -> None:
|
||||
|
||||
@@ -1792,18 +1792,13 @@ def _show_quick_start_summary(config: Config) -> None:
|
||||
)
|
||||
has_api_key = is_local or bool(provider_config and provider_config.api_key)
|
||||
|
||||
start_command = "`nanobot gateway`"
|
||||
next_step = f"Run {start_command}"
|
||||
status = "Ready"
|
||||
if not has_api_key:
|
||||
status = f"{provider_label} API key missing"
|
||||
next_step = f"Add your {provider_label} API key, then run {start_command}"
|
||||
|
||||
rows = [
|
||||
("Status", status),
|
||||
("Next", next_step),
|
||||
("WebSocket channel", "enabled"),
|
||||
("Open", "http://127.0.0.1:8765"),
|
||||
]
|
||||
_print_summary_panel(rows, "Quick Start")
|
||||
|
||||
|
||||
@@ -1451,7 +1451,7 @@ class TestMainMenuUpdate:
|
||||
assert "primary" not in config.model_presets
|
||||
|
||||
def test_quick_start_summary_calls_out_missing_api_key(self, monkeypatch):
|
||||
"""Quick Start summary should not tell users to run gateway before adding a key."""
|
||||
"""Quick Start summary should retain the missing-key status."""
|
||||
config = Config()
|
||||
config.model_presets["primary"] = ModelPresetConfig(
|
||||
model="deepseek-v4-flash",
|
||||
@@ -1469,17 +1469,9 @@ class TestMainMenuUpdate:
|
||||
|
||||
onboard_wizard._show_quick_start_summary(config)
|
||||
|
||||
labels = [label for label, _value in captured["rows"]]
|
||||
rows = dict(captured["rows"])
|
||||
assert rows["Status"] == "DeepSeek API key missing"
|
||||
assert "API key" in rows["Next"]
|
||||
assert "nanobot gateway" in rows["Next"]
|
||||
assert "agent -m" not in rows["Next"]
|
||||
assert labels.index("Next") < labels.index("Open")
|
||||
assert "Model" not in rows
|
||||
assert "Entry point" not in rows
|
||||
assert "API key" not in rows
|
||||
assert "Defaults" not in rows
|
||||
assert rows["WebSocket channel"] == "enabled"
|
||||
|
||||
def test_configure_login_channel_defaults_to_login(self, monkeypatch):
|
||||
"""The channel wizard should start login before exposing advanced fields."""
|
||||
|
||||
@@ -268,6 +268,14 @@ def test_onboard_fresh_install(mock_paths):
|
||||
assert mock_ws.call_args.args == (expected_workspace,)
|
||||
|
||||
|
||||
def test_onboard_recommends_webui(mock_paths):
|
||||
"""Default onboarding should recommend the guided WebUI launcher."""
|
||||
result = runner.invoke(app, ["onboard"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert "✓ nanobot is ready. Run: nanobot webui" in result.stdout
|
||||
|
||||
|
||||
def test_onboard_existing_config_refresh(mock_paths):
|
||||
"""Config exists, user declines overwrite — should refresh (load-merge-save)."""
|
||||
config_file, workspace_dir, _ = mock_paths
|
||||
@@ -413,7 +421,7 @@ def test_onboard_uses_explicit_config_and_workspace_paths(tmp_path, monkeypatch)
|
||||
compact_output = stripped_output.replace("\n", "")
|
||||
resolved_config = str(config_path.resolve())
|
||||
assert resolved_config in compact_output
|
||||
assert f"--config {resolved_config}" in compact_output
|
||||
assert f'nanobot webui -c "{resolved_config}"' in result.stdout
|
||||
|
||||
|
||||
def test_onboard_wizard_preserves_explicit_config_in_next_steps(tmp_path, monkeypatch):
|
||||
@@ -434,11 +442,8 @@ def test_onboard_wizard_preserves_explicit_config_in_next_steps(tmp_path, monkey
|
||||
)
|
||||
|
||||
assert result.exit_code == 0
|
||||
stripped_output = _strip_ansi(result.stdout)
|
||||
compact_output = stripped_output.replace("\n", "")
|
||||
resolved_config = str(config_path.resolve())
|
||||
assert f'nanobot agent -m "Hello!" --config {resolved_config}' in compact_output
|
||||
assert f"nanobot gateway --config {resolved_config}" in compact_output
|
||||
assert f'nanobot webui -c "{resolved_config}"' in result.stdout
|
||||
|
||||
|
||||
def test_config_matches_github_copilot_codex_with_hyphen_prefix():
|
||||
|
||||
Reference in New Issue
Block a user