fix(onboard): use configured workspace path on setup

This commit is contained in:
Xubin Ren
2026-03-17 05:01:34 +00:00
parent c4cc2a9fb4
commit 40a022afd9
3 changed files with 11 additions and 8 deletions

View File

@@ -45,7 +45,7 @@ def mock_paths():
mock_ws.return_value = workspace_dir
mock_sc.side_effect = lambda config: config_file.write_text("{}")
yield config_file, workspace_dir
yield config_file, workspace_dir, mock_ws
if 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_paths
result = 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_paths
config_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_paths
config_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_paths
workspace_dir.mkdir(parents=True)
config_file.write_text("{}")