Skip to content

Commit c6e00bf

Browse files
committed
cache bmignore list during bisync
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent fcd1fe0 commit c6e00bf

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed

docs/cloud-cli.md

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,24 +211,68 @@ bm sync --watch --interval 30
211211

212212
### Bisync Profiles
213213

214-
Bisync supports different conflict resolution strategies:
214+
Bisync supports three conflict resolution strategies with different safety levels:
215215

216-
- **balanced** (default, recommended): Auto-resolve to newer file, max 25 deletes
217-
- **safe**: Keep both versions on conflict, max 10 deletes
218-
- **fast**: Fast iteration mode, max 50 deletes
216+
| Profile | Conflict Resolution | Max Deletes | Use Case |
217+
|---------|-------------------|-------------|----------|
218+
| **balanced** | newer | 25 | Default, recommended for most users |
219+
| **safe** | none | 10 | Keep both versions on conflict |
220+
| **fast** | newer | 50 | Rapid iteration, higher delete tolerance |
219221

220-
To use a specific profile:
222+
**Profile Details:**
223+
224+
- **safe**:
225+
- Conflict resolution: `none` (creates `.conflict` files for both versions)
226+
- Max delete: 10 files per sync
227+
- Best for: Critical data where you want manual conflict resolution
228+
229+
- **balanced** (default):
230+
- Conflict resolution: `newer` (auto-resolve to most recent file)
231+
- Max delete: 25 files per sync
232+
- Best for: General use with automatic conflict handling
233+
234+
- **fast**:
235+
- Conflict resolution: `newer` (auto-resolve to most recent file)
236+
- Max delete: 50 files per sync
237+
- Best for: Rapid development iteration with less restrictive safety checks
238+
239+
**How to Select a Profile:**
240+
241+
The default profile (`balanced`) is used automatically with `bm sync`:
221242

222243
```bash
244+
# Uses balanced profile (default)
245+
bm sync
246+
```
247+
248+
For advanced control, use `bm cloud bisync` with the `--profile` flag:
249+
250+
```bash
251+
# Use safe mode
223252
bm cloud bisync --profile safe
253+
254+
# Use fast mode
255+
bm cloud bisync --profile fast
256+
257+
# Preview changes with specific profile
258+
bm cloud bisync --profile safe --dry-run
224259
```
225260

226-
Check available profiles:
261+
**Check Available Profiles:**
227262

228263
```bash
229264
bm cloud status
230265
```
231266

267+
This shows all available profiles with their settings.
268+
269+
**Current Limitations:**
270+
271+
- Profiles are hardcoded and cannot be customized
272+
- No config file option to change default profile
273+
- Profile settings (max_delete, conflict_resolve) cannot be modified without code changes
274+
- Profile selection only available via `bm cloud bisync --profile` (advanced command)
275+
232276
### Establishing New Baseline
233277

234278
If you need to force a complete resync:

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ def convert_bmignore_to_rclone_filters() -> Path:
238238
Reads ~/.basic-memory/.bmignore (gitignore-style) and converts to
239239
~/.basic-memory/.bmignore.rclone (rclone filter format).
240240
241+
Only regenerates if .bmignore has been modified since last conversion.
242+
241243
Returns:
242244
Path to converted rclone filter file
243245
"""
@@ -248,6 +250,13 @@ def convert_bmignore_to_rclone_filters() -> Path:
248250
# Create rclone filter path: ~/.basic-memory/.bmignore -> ~/.basic-memory/.bmignore.rclone
249251
rclone_filter_path = bmignore_path.parent / f"{bmignore_path.name}.rclone"
250252

253+
# Skip regeneration if rclone file is newer than bmignore
254+
if rclone_filter_path.exists():
255+
bmignore_mtime = bmignore_path.stat().st_mtime
256+
rclone_mtime = rclone_filter_path.stat().st_mtime
257+
if rclone_mtime >= bmignore_mtime:
258+
return rclone_filter_path
259+
251260
# Read .bmignore patterns
252261
patterns = []
253262
try:

0 commit comments

Comments
 (0)