mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
feat(cli): expose project sync support metadata
Signed-off-by: Drew Cain <groksrc@gmail.com>
This commit is contained in:
committed by
Paul Hernandez
parent
8bf7bdbc0d
commit
f07643d3a8
@@ -35,6 +35,16 @@ from basic_memory.utils import generate_permalink
|
||||
# --- Helpers for dual-fetch + merge ---
|
||||
|
||||
|
||||
def _sync_support_metadata(workspace_type: str | None) -> dict[str, object]:
|
||||
"""Return structured local sync support fields for project listings."""
|
||||
sync_supported = workspace_type is None or workspace_type == "personal"
|
||||
return {
|
||||
"sync_supported": sync_supported,
|
||||
"sync_reason": None if sync_supported else f"{workspace_type} workspace",
|
||||
"local_usage": "sync-supported" if sync_supported else "cloud-only",
|
||||
}
|
||||
|
||||
|
||||
def _merge_projects(
|
||||
local_list: ProjectList | None,
|
||||
cloud_list: ProjectList | None,
|
||||
@@ -125,6 +135,7 @@ def _merge_projects(
|
||||
"workspace_tenant_id": ws_tenant_id,
|
||||
"workspace_slug": cloud_workspace_slug if cloud_proj else None,
|
||||
"workspace_is_default": cloud_workspace_is_default if cloud_proj else False,
|
||||
**_sync_support_metadata(ws_type),
|
||||
"qualified_name": (
|
||||
f"{cloud_workspace_slug}/{permalink}"
|
||||
if cloud_proj and cloud_workspace_slug
|
||||
@@ -258,6 +269,7 @@ def _merge_workspace_projects(
|
||||
"workspace_tenant_id": entry.workspace.tenant_id,
|
||||
"workspace_slug": entry.workspace.slug,
|
||||
"workspace_is_default": entry.workspace.is_default,
|
||||
**_sync_support_metadata(entry.workspace.workspace_type),
|
||||
"qualified_name": entry.qualified_name,
|
||||
}
|
||||
)
|
||||
@@ -282,6 +294,7 @@ def _merge_workspace_projects(
|
||||
"workspace_tenant_id": None,
|
||||
"workspace_slug": None,
|
||||
"workspace_is_default": False,
|
||||
**_sync_support_metadata(None),
|
||||
"qualified_name": None,
|
||||
}
|
||||
)
|
||||
@@ -313,7 +326,10 @@ def _format_project_list_text(merged: list[dict]) -> str:
|
||||
source = project["source"]
|
||||
external_id = project.get("external_id", "")
|
||||
id_suffix = f" [{external_id}]" if external_id else ""
|
||||
result += f"- {label} ({source}){id_suffix}\n"
|
||||
usage_suffix = ""
|
||||
if project.get("sync_supported") is False:
|
||||
usage_suffix = " - cloud-only (local sync unsupported)"
|
||||
result += f"- {label} ({source}){id_suffix}{usage_suffix}\n"
|
||||
|
||||
result += "\n" + "─" * 40 + "\n"
|
||||
result += "Next: Ask which project to use for this session.\n"
|
||||
|
||||
Reference in New Issue
Block a user