Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(onboard): use configured workspace path on setup
Xubin Ren40a022afd9e5
diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.pyindex 47f7316bb..a1a6341ee 100644--- a/nanobot/cli/commands.py+++ b/nanobot/cli/commands.py@@ -282,7 +282,8 @@ def onboard():save_config(config)console.print(f"[green]✓[/green] Config refreshed at {config_path} (existing values preserved)")else:- save_config(Config())+ config = Config()+ save_config(config)console.print(f"[green]✓[/green] Created config at {config_path}")console.print("[dim]Config template now uses `maxTokens` + `contextWindowTokens`; `memoryWindow` is no longer a runtime setting.[/dim]")diff --git a/tests/test_commands.py b/tests/test_commands.pyindex b09c95553..ce36a6d8f 100644--- a/tests/test_commands.py+++ b/tests/test_commands.py@@ -45,7 +45,7 @@ def mock_paths():mock_ws.return_value = workspace_dirmock_sc.side_effect = lambda config: config_file.write_text("{}")- yield config_file, workspace_dir+ yield config_file, workspace_dir, mock_wsif base_dir.exists():shutil.rmtree(base_dir)@@ -53,7 +53,7 @@ def mock_paths():def test_onboard_fresh_install(mock_paths):"""No existing config — should create from scratch."""- config_file, workspace_dir = mock_paths+ config_file, workspace_dir, mock_ws = mock_pathsresult = runner.invoke(app, ["onboard"])@@ -64,11 +64,13 @@ def test_onboard_fresh_install(mock_paths):assert config_file.exists()assert (workspace_dir / "AGENTS.md").exists()assert (workspace_dir / "memory" / "MEMORY.md").exists()+ expected_workspace = Config().workspace_path+ assert mock_ws.call_args.args == (expected_workspace,)def test_onboard_existing_config_refresh(mock_paths):"""Config exists, user declines overwrite — should refresh (load-merge-save)."""- config_file, workspace_dir = mock_paths+ config_file, workspace_dir, _ = mock_pathsconfig_file.write_text('{"existing": true}')result = runner.invoke(app, ["onboard"], input="n\n")@@ -82,7 +84,7 @@ def test_onboard_existing_config_refresh(mock_paths):def test_onboard_existing_config_overwrite(mock_paths):"""Config exists, user confirms overwrite — should reset to defaults."""- config_file, workspace_dir = mock_paths+ config_file, workspace_dir, _ = mock_pathsconfig_file.write_text('{"existing": true}')result = runner.invoke(app, ["onboard"], input="y\n")@@ -95,7 +97,7 @@ def test_onboard_existing_config_overwrite(mock_paths):def test_onboard_existing_workspace_safe_create(mock_paths):"""Workspace exists — should not recreate, but still add missing templates."""- config_file, workspace_dir = mock_paths+ config_file, workspace_dir, _ = mock_pathsworkspace_dir.mkdir(parents=True)config_file.write_text("{}")diff --git a/tests/test_config_migration.py b/tests/test_config_migration.pyindex f800fb59e..2a446b774 100644--- a/tests/test_config_migration.py+++ b/tests/test_config_migration.py@@ -76,7 +76,7 @@ def test_onboard_refresh_rewrites_legacy_config_template(tmp_path, monkeypatch))monkeypatch.setattr("nanobot.config.loader.get_config_path", lambda: config_path)- monkeypatch.setattr("nanobot.cli.commands.get_workspace_path", lambda: workspace)+ monkeypatch.setattr("nanobot.cli.commands.get_workspace_path", lambda _workspace=None: workspace)result = runner.invoke(app, ["onboard"], input="n\n")@@ -109,7 +109,7 @@ def test_onboard_refresh_backfills_missing_channel_fields(tmp_path, monkeypatch))monkeypatch.setattr("nanobot.config.loader.get_config_path", lambda: config_path)- monkeypatch.setattr("nanobot.cli.commands.get_workspace_path", lambda: workspace)+ monkeypatch.setattr("nanobot.cli.commands.get_workspace_path", lambda _workspace=None: workspace)monkeypatch.setattr("nanobot.channels.registry.discover_all",lambda: {