Skip to content

Commit 84c0b36

Browse files
phernandezclaude
andcommitted
feat: Add comprehensive cloud mount CLI commands and documentation
This commit implements SPEC-7 Phase 4 by adding local file access capabilities to the Basic Memory Cloud CLI, enabling users to mount their cloud files locally for real-time editing. New features: - Cloud mount setup with automatic rclone installation - Mount/unmount/status commands with three performance profiles - Cross-platform rclone installer with package manager fallbacks - Mount configuration management with tenant-specific credentials - Comprehensive documentation with examples and troubleshooting Mount profiles: - fast: 5s sync for active development - balanced: 10-15s sync (recommended) - safe: 15s+ sync with conflict detection Technical implementation: - Uses rclone NFS mount (no FUSE dependencies) - Tigris object storage with scoped credentials - Bidirectional sync with configurable cache settings - Process management and cleanup Fixes Python module conflict by moving cloud.py commands to cloud/core_commands.py to resolve typer CLI loading issues with cloud.py file vs cloud/ directory. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> Signed-off-by: phernandez <[email protected]>
1 parent 2c5c606 commit 84c0b36

File tree

4 files changed

+173
-6
lines changed

4 files changed

+173
-6
lines changed

docs/cloud-cli.md

Lines changed: 166 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Basic Memory Cloud CLI Guide
22

3-
The Basic Memory Cloud CLI provides commands for interacting with Basic Memory Cloud instances, including authentication, project management, and file synchronization. This guide covers installation, configuration, and usage of the cloud features.
3+
The Basic Memory Cloud CLI provides commands for interacting with Basic Memory Cloud instances, including authentication, project management, file synchronization, and local file access. This guide covers installation, configuration, and usage of the cloud features.
44

55
## Overview
66

77
The cloud CLI enables you to:
88
- Authenticate with Basic Memory Cloud using OAuth
99
- List and create projects on cloud instances
1010
- Upload local files and directories to cloud projects via WebDAV
11+
- Mount cloud files locally for real-time editing with rclone
1112
- Check the health status of cloud instances
1213
- Automatically filter uploads using gitignore patterns
1314

@@ -141,6 +142,136 @@ Uploading 23 file(s) to project 'my-project' on https://cloud.basicmemory.com...
141142
Successfully uploaded 23 file(s)!
142143
```
143144

145+
## Local File Access
146+
147+
Basic Memory Cloud supports mounting your cloud files locally using rclone, enabling real-time editing with your favorite text editor or IDE. Changes made locally are automatically synchronized to the cloud.
148+
149+
### Setup
150+
151+
Before mounting files, you need to set up the local access system:
152+
153+
```bash
154+
bm cloud setup
155+
```
156+
157+
This command will:
158+
1. Check if rclone is installed (and install it if needed)
159+
2. Retrieve your tenant information from the cloud
160+
3. Generate secure, scoped credentials for your tenant
161+
4. Configure rclone with your tenant's storage settings
162+
5. Display instructions for mounting your files
163+
164+
### Mounting Files
165+
166+
Mount your cloud files to a local directory:
167+
168+
```bash
169+
# Mount with default (balanced) profile
170+
bm cloud mount
171+
172+
# Mount with specific profile
173+
bm cloud mount --profile fast
174+
bm cloud mount --profile balanced
175+
bm cloud mount --profile safe
176+
```
177+
178+
#### Mount Profiles
179+
180+
Different profiles optimize for different use cases:
181+
182+
- **fast**: Ultra-fast development (5s sync, higher bandwidth)
183+
- Cache time: 5s, Poll interval: 3s
184+
- Best for: Active development, frequent file changes
185+
186+
- **balanced**: Fast development (10-15s sync, recommended)
187+
- Cache time: 10s, Poll interval: 5s
188+
- Best for: General use, good balance of speed and reliability
189+
190+
- **safe**: Conflict-aware mount with backup (15s+ sync)
191+
- Cache time: 15s, Poll interval: 10s
192+
- Includes conflict detection and backup functionality
193+
- Best for: Collaborative editing, important documents
194+
195+
### Mount Status
196+
197+
Check the current mount status:
198+
199+
```bash
200+
bm cloud mount-status
201+
```
202+
203+
Example output:
204+
```
205+
Cloud Mount Status
206+
┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
207+
┃ Property ┃ Value ┃
208+
┡━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
209+
│ Tenant ID │ 63cd4020-2e31-5c53-bdbc-07182b129183 │
210+
│ Mount Path │ ~/basic-memory-63cd4020-2e31-5c53-bdbc-07182b129183 │
211+
│ Status │ ✓ Mounted │
212+
│ rclone Processes │ 1 running │
213+
└──────────────────┴───────────────────────────────────────────────────────────┘
214+
215+
Available mount profiles:
216+
fast: Ultra-fast development (5s sync, higher bandwidth)
217+
balanced: Fast development (10-15s sync, recommended)
218+
safe: Conflict-aware mount with backup
219+
```
220+
221+
### Unmounting Files
222+
223+
Unmount your cloud files and clean up processes:
224+
225+
```bash
226+
bm cloud unmount
227+
```
228+
229+
This command will:
230+
1. Unmount the filesystem
231+
2. Kill any running rclone processes
232+
3. Clean up temporary files
233+
234+
### Working with Mounted Files
235+
236+
Once mounted, your cloud files appear as a regular directory on your local system. You can:
237+
238+
- Edit files with any text editor or IDE
239+
- Create new files and directories
240+
- Move and rename files
241+
- Use command-line tools like `grep`, `find`, etc.
242+
243+
#### Example Workflow
244+
245+
```bash
246+
# Set up local access
247+
bm cloud setup
248+
249+
# Mount your files
250+
bm cloud mount --profile balanced
251+
252+
# Navigate to your mounted files
253+
cd ~/basic-memory-{your-tenant-id}
254+
255+
# Edit files with your preferred editor
256+
code my-notes.md
257+
vim research/paper.md
258+
259+
# Changes are automatically synced to the cloud
260+
# Check sync status
261+
bm cloud mount-status
262+
263+
# When done, unmount
264+
bm cloud unmount
265+
```
266+
267+
### Technical Details
268+
269+
- **Protocol**: Uses rclone with NFS mount (no FUSE dependencies)
270+
- **Storage**: Files are stored in Tigris object storage (S3-compatible)
271+
- **Sync**: Bidirectional synchronization with configurable cache settings
272+
- **Security**: Uses scoped, time-limited credentials for your tenant only
273+
- **Compatibility**: Works on macOS, Linux, and Windows
274+
144275
## Instance Management
145276

146277
### Health Check
@@ -192,7 +323,7 @@ By default, the CLI uses production authentication settings. For development or
192323

193324
```bash
194325
# For development environment
195-
export BASIC_MEMORY_CLOUD_HOST="http://development.cloud.basicmemory.com"
326+
export BASIC_MEMORY_CLOUD_HOST="https://development.cloud.basicmemory.com"
196327
export BASIC_MEMORY_CLOUD_CLIENT_ID="client_01K46RED2BW9YKYE4N7Y9BDN2V"
197328
export BASIC_MEMORY_CLOUD_DOMAIN="https://exciting-aquarium-32-staging.authkit.app"
198329

@@ -243,6 +374,32 @@ bm cloud upload my-project ./path --no-gitignore
243374
1. Verify the cloud instance is running: `bm cloud status`
244375
2. Check your internet connection
245376

377+
### Mount Issues
378+
379+
**Problem**: "rclone not found" during setup
380+
**Solution**: The setup command will attempt to install rclone automatically. If this fails:
381+
- **macOS**: `brew install rclone`
382+
- **Linux**: `sudo snap install rclone` or `sudo apt install rclone`
383+
- **Windows**: `winget install Rclone.Rclone`
384+
385+
**Problem**: Mount fails with permission errors
386+
**Solution**:
387+
- Ensure you have proper permissions for the mount directory
388+
- On Linux, you may need to add your user to the `fuse` group
389+
- Try unmounting any existing mounts: `bm cloud unmount`
390+
391+
**Problem**: Files not syncing or appearing outdated
392+
**Solution**:
393+
1. Check mount status: `bm cloud mount-status`
394+
2. Try remounting with a faster profile: `bm cloud mount --profile fast`
395+
3. Unmount and remount: `bm cloud unmount && bm cloud mount`
396+
397+
**Problem**: Multiple mount processes running
398+
**Solution**: Clean up orphaned processes:
399+
```bash
400+
bm cloud unmount # This will clean up all processes
401+
bm cloud mount # Fresh mount
402+
```
246403

247404
## Security
248405

@@ -264,8 +421,14 @@ bm cloud project add <name> [--default]
264421
# File operations
265422
bm cloud upload <project> <path> [--no-preserve-timestamps] [--no-gitignore]
266423

424+
# Local file access
425+
bm cloud setup # Set up local access with rclone
426+
bm cloud mount [--profile <profile>] # Mount cloud files locally
427+
bm cloud mount-status # Check mount status
428+
bm cloud unmount # Unmount cloud files
429+
267430
# Instance management
268-
bm cloud status
431+
bm cloud status
269432
```
270433

271434
For more information about Basic Memory Cloud, visit the [official documentation](https://memory.basicmachines.co).

src/basic_memory/cli/commands/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
"import_chatgpt",
1515
"tool",
1616
"project",
17+
"cloud",
1718
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
"""Cloud commands package."""
2+
3+
# Import all commands to register them with typer
4+
from basic_memory.cli.commands.cloud.core_commands import * # noqa: F401,F403

src/basic_memory/cli/commands/cloud.py renamed to src/basic_memory/cli/commands/cloud/core_commands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Command module for basic-memory cloud operations."""
1+
"""Core cloud commands for Basic Memory CLI."""
22

33
import asyncio
44
from pathlib import Path
@@ -46,7 +46,7 @@ async def _login():
4646
asyncio.run(_login())
4747

4848

49-
# Project
49+
# Project commands
5050

5151
project_app = typer.Typer(help="Manage Basic Memory Cloud Projects")
5252
cloud_app.add_typer(project_app, name="project")
@@ -395,4 +395,4 @@ def unmount() -> None:
395395
@cloud_app.command("mount-status")
396396
def mount_status() -> None:
397397
"""Show current mount status."""
398-
show_mount_status()
398+
show_mount_status()

0 commit comments

Comments
 (0)