Skip to content

Commit 8eeec64

Browse files
authored
fix: basic-memory project list does not list projects from all workspaces (#822)
Signed-off-by: Drew Cain <groksrc@gmail.com>
1 parent c6fa185 commit 8eeec64

7 files changed

Lines changed: 1167 additions & 100 deletions

File tree

src/basic_memory/cli/commands/cloud/workspace.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
from basic_memory.cli.commands.command_utils import run_with_cleanup
88
from basic_memory.config import ConfigManager
9-
from basic_memory.mcp.project_context import (
10-
_workspace_choices,
11-
_workspace_matches_identifier,
12-
get_available_workspaces,
9+
from basic_memory.mcp.project_context import get_available_workspaces
10+
from basic_memory.schemas.cloud import (
11+
format_workspace_choices,
12+
format_workspace_selection_choices,
13+
workspace_matches_identifier,
1314
)
1415

1516
console = Console()
@@ -62,7 +63,10 @@ async def _list():
6263

6364
@workspace_app.command("set-default")
6465
def set_default_workspace(
65-
identifier: str = typer.Argument(..., help="Workspace name or tenant_id to set as default"),
66+
identifier: str = typer.Argument(
67+
...,
68+
help="Workspace name, slug, type, or tenant_id to set as default",
69+
),
6670
) -> None:
6771
"""Set the default cloud workspace.
6872
@@ -71,6 +75,7 @@ def set_default_workspace(
7175
7276
Examples:
7377
bm cloud workspace set-default Personal
78+
bm cloud workspace set-default organization
7479
bm cloud workspace set-default 11111111-1111-1111-1111-111111111111
7580
"""
7681

@@ -87,19 +92,21 @@ async def _list():
8792
console.print("[yellow]No accessible workspaces found.[/yellow]")
8893
raise typer.Exit(1)
8994

90-
matches = [ws for ws in workspaces if _workspace_matches_identifier(ws, identifier)]
95+
matches = [ws for ws in workspaces if workspace_matches_identifier(ws, identifier)]
9196

9297
if not matches:
9398
console.print(f"[red]Error: Workspace '{identifier}' not found[/red]")
94-
console.print(f"[dim]Available:\n{_workspace_choices(workspaces)}[/dim]")
99+
console.print(f"[dim]Available:\n{format_workspace_choices(workspaces)}[/dim]")
95100
raise typer.Exit(1)
96101

97102
if len(matches) > 1:
98103
console.print(
99-
f"[red]Error: Workspace name '{identifier}' matches multiple workspaces. "
100-
f"Use tenant_id instead.[/red]"
104+
f"[red]Error: Workspace '{identifier}' matches multiple workspaces.[/red]"
105+
)
106+
console.print(
107+
"[dim]Choose one of these matching workspaces by slug:\n"
108+
f"{format_workspace_selection_choices(matches)}[/dim]"
101109
)
102-
console.print(f"[dim]Available:\n{_workspace_choices(workspaces)}[/dim]")
103110
raise typer.Exit(1)
104111

105112
selected = matches[0]

0 commit comments

Comments
 (0)