@@ -74,7 +74,7 @@ def __init__(
7474}
7575
7676
77- async def get_tenant_info () -> dict :
77+ async def get_mount_info () -> dict :
7878 """Get current tenant information from cloud API."""
7979 try :
8080 config_manager = ConfigManager ()
@@ -352,9 +352,9 @@ def setup_cloud_bisync(sync_dir: Optional[str] = None) -> None:
352352 console .print ("[blue]Step 1: Installing rclone...[/blue]" )
353353 install_rclone ()
354354
355- # Step 2: Get tenant info
355+ # Step 2: Get mount info (for tenant_id, bucket)
356356 console .print ("\n [blue]Step 2: Getting tenant information...[/blue]" )
357- tenant_info = asyncio .run (get_tenant_info ())
357+ tenant_info = asyncio .run (get_mount_info ())
358358
359359 tenant_id = tenant_info .get ("tenant_id" )
360360 bucket_name = tenant_info .get ("bucket_name" )
@@ -449,7 +449,7 @@ def run_bisync(
449449 try :
450450 # Get tenant info if not provided
451451 if not tenant_id or not bucket_name :
452- tenant_info = asyncio .run (get_tenant_info ())
452+ tenant_info = asyncio .run (get_mount_info ())
453453 tenant_id = tenant_info .get ("tenant_id" )
454454 bucket_name = tenant_info .get ("bucket_name" )
455455
@@ -461,6 +461,7 @@ def run_bisync(
461461 local_path = get_bisync_directory ()
462462
463463 # Validate bisync directory
464+ # can be same dir as mount
464465 validate_bisync_directory (local_path )
465466
466467 # Check if local path exists
@@ -504,7 +505,9 @@ def run_bisync(
504505 asyncio .run (create_cloud_project (project_name ))
505506 console .print (f"[green] ✓ Created project: { project_name } [/green]" )
506507 except BisyncError as e :
507- console .print (f"[yellow] ⚠ Could not create { project_name } : { e } [/yellow]" )
508+ console .print (
509+ f"[yellow] ⚠ Could not create { project_name } : { e } [/yellow]"
510+ )
508511 else :
509512 console .print ("[dim]All local projects already registered on cloud[/dim]" )
510513
@@ -566,18 +569,32 @@ def run_bisync(
566569
567570
568571async def notify_container_sync (tenant_id : str ) -> None :
569- """Notify the cloud container to refresh its TigrisFS cache ."""
572+ """Sync all projects after bisync completes ."""
570573 try :
571- config_manager = ConfigManager ()
572- config = config_manager .config
573- host_url = config .cloud_host .rstrip ("/" )
574+ from basic_memory .cli .commands .command_utils import run_sync
574575
575- # Call the sync endpoint to trigger cache refresh
576- await make_api_request (method = "POST" , url = f"{ host_url } /proxy/sync" )
577- console .print ("[dim]✓ Notified container to refresh cache[/dim]" )
578- except Exception :
579- # Non-critical, don't fail the sync
580- pass
576+ # Fetch all projects and sync each one
577+ cloud_data = await fetch_cloud_projects ()
578+ projects = cloud_data .get ("projects" , [])
579+
580+ if not projects :
581+ console .print ("[dim]No projects to sync[/dim]" )
582+ return
583+
584+ console .print (f"[dim]Syncing { len (projects )} project(s)...[/dim]" )
585+
586+ for project in projects :
587+ project_name = project .get ("name" )
588+ if project_name :
589+ try :
590+ await run_sync (project = project_name )
591+ except Exception as e :
592+ # Non-critical, log and continue
593+ console .print (f"[yellow] ⚠ Sync failed for { project_name } : { e } [/yellow]" )
594+
595+ except Exception as e :
596+ # Non-critical, don't fail the bisync
597+ console .print (f"[yellow]Warning: Post-sync failed: { e } [/yellow]" )
581598
582599
583600def run_bisync_watch (
@@ -625,7 +642,7 @@ def show_bisync_status() -> None:
625642
626643 try :
627644 # Get tenant info
628- tenant_info = asyncio .run (get_tenant_info ())
645+ tenant_info = asyncio .run (get_mount_info ())
629646 tenant_id = tenant_info .get ("tenant_id" )
630647
631648 if not tenant_id :
0 commit comments