feat: Phase 2 cloud sync client (crates/cloud)#43
Merged
Conversation
Introduces the client-side cloud sync layer for nichinichi.
Local functionality is unchanged; cloud is additive and opt-in.
- crates/cloud: new CloudClient crate (reqwest-based HTTP client)
- client.rs: CloudClient with sync, push_file, pull_changed,
sign_in, sign_out, register methods
- manifest.rs: local file manifest (SyncManifest, ManifestEntry)
for diff-based reconciliation with the server
- merge.rs: conflict resolution strategies (RemoteWins/LocalWins/
Error) and merge_entry() for daily entry block-level merging
- error.rs: CloudError types
- crates/types: add CloudConfig struct (base_url, token,
last_synced_at, conflict_strategy) as optional field on Config
- Cargo.toml: add crates/cloud workspace member
Next: wire CloudClient into file watcher and Tauri commands (Phase 2.2)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/cloud— the client-side cloud sync library for nichinichicrates/typeswithCloudConfig(opt-in, defaults to disabled)New crate:
crates/cloudclient.rsCloudClient— HTTP sync operations (reconcile, push, pull, auth)manifest.rsSyncManifest— local file index for diff-based syncmerge.rsRemoteWins/LocalWins/Error, block-level merge for daily entry fileserror.rsCloudErrortypesConfig change (
crates/types)Adds an optional
cloudfield toConfig:Omitting
cloud:from~/.nichinichi.ymlkeeps existing behaviour.Test plan
cargo build -p nichinichi-cloudpasses with no errorscargo test -p nichinichi-cloudpasses (merge unit tests)cargo test -p nichinichi-parser -p nichinichi-syncCloudConfigdeserialises correctly from YAML with and without thecloud:keyWhat's next (Phase 2.2)
Wire
CloudClientinto the Tauri file watcher hook and add Tauri commands (cloud_sign_in,cloud_sync_now,get_cloud_status, etc.).🤖 Generated with Claude Code