Skip to content

Two-Way Filesystem Sync for Spaces#13

Merged
ccssmnn merged 20 commits intomainfrom
ccssmnn/bidrectional-sync
Feb 16, 2026
Merged

Two-Way Filesystem Sync for Spaces#13
ccssmnn merged 20 commits intomainfrom
ccssmnn/bidrectional-sync

Conversation

@ccssmnn
Copy link
Owner

@ccssmnn ccssmnn commented Feb 14, 2026

This PR enhances the filesystem backup functionality to optionally do two-way sync. This enables collaborating with an AI agent like opencode or claude code on the documents.

Only available on chromium browsers.

- Add BackupManifest, ManifestEntry, ScannedFile types
- Add scanBackupFolder() to recursively read markdown + assets
- Add readManifest() and writeManifest() helpers
- Add transformContentForImport() for reverse asset reference conversion
- Add tests for scanner, manifest, and content transform
- Add bidirectional flag to BackupState (default true for new installs)
- Add setBidirectional setter and reset handling
- Add lastPullAt tracking for UI display
- Add BACKUP_PULL_INTERVAL_MS constant (20s)
- Add hashContent(), syncFromBackup(), createDocFromFile(), updateDocFromFile()
- Add pull loop with visibility detection and 20s interval
- Update BackupSubscriber to include bidirectional sync (bidirectional flag)
- Add setLastPullAt tracking for UI display
- Support creating/updating/deleting docs from filesystem changes
- Add pull loop to SpaceBackupSubscriber with visibility detection
- Space backups always bidirectional (respects user permissions for writes)
- Check admin/writer role before allowing sync-from-backup writes
- Add periodic pull with 20s interval
- Remove unused lastPullAt state variable
- Add hashContent tests (consistency, different content, unicode, empty)
- Add bidirectional sync export tests
- Export hashContent and syncFromBackup for testing
- Fix self aliasing lint issues in test mocks
- Add readManifest and writeManifest exports
- Show warning in UI when File System Access API is not supported (Safari/Firefox)
- Use FileSystemDirectoryHandle.watch() for real-time file change detection when available (Chrome 110+)
- Fall back to polling (20s interval) when watch is not supported
- Add supportsFileSystemWatch() detection helper
- Remove 20s polling interval fallback
- Use FileSystemDirectoryHandle.watch() when available
- Fall back to pull on visibility change and manual sync only
- Remove unused _BACKUP_PULL_INTERVAL_MS constant
- Only enable bidirectional sync when watch API is available
- Disable the sync toggle in UI when watch is not supported
- Show appropriate message explaining browser requirement
- Remove visibility-based pull fallback (only real-time watch)
@vercel
Copy link

vercel bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
alkalye Ready Ready Preview, Comment Feb 16, 2026 8:22am

@ccssmnn ccssmnn merged commit d388838 into main Feb 16, 2026
4 checks passed
@ccssmnn ccssmnn deleted the ccssmnn/bidrectional-sync branch February 16, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant