Sync Files (zeysdk sync)
Synchronize local files with the ZeyOS server, handling bidirectional file synchronization and conflict resolution.
zeysdk sync [files...] [options]
Parameters
| Parameter | Description | Required | Example |
|---|---|---|---|
files | Specific files to sync | ❌ | services/backup.js |
Options
| Option | Description | Default |
|---|---|---|
-f, --force | Skip sync confirmations | false |
--rehash | Force rehashing of all files | false |
--verbose | Show detailed sync progress | false |
Status Indicators
| Symbol | Meaning |
|---|---|
| + | Created locally |
| + | Added on server |
| - | Deleted locally |
| - | Deleted on server |
| ~ | Modified locally |
| ~ | Modified on server |
| ! | Conflict (modified both locally and on server) |
| ⟷ | Property conflict |
| → | Local changes to be pushed |
| ← | Server changes to be pulled |
Conflict Resolution
When conflicts are detected:
-
Content Conflicts
! Modified locally and on server
> Take server version
> Take local version
> Merge changes
> Skip file -
Property Conflicts
! Property conflicts detected:
public: 0 ⟷ 1
type: "TIMING" ⟷ "REMOTECALL"
File Hashing and Synchronization
The sync process determines which files need to be synchronized by comparing file hashes and timestamps:
-
Automatic Rehashing: Files are automatically rehashed when:
- The file's last modified timestamp is newer than the stored timestamp
- The file size has changed
- No hash exists in the sync.json file
- The lastmodified field is empty or invalid
-
Manual Rehashing: Use the
--rehashflag to force rehashing of all files, which is useful when:- Timestamps are unreliable
- You suspect hash inconsistencies
- After manually editing files outside the SDK
-
Verbose Logging: Use
--verboseto see detailed information about:- Which files are being rehashed and why
- Cache hits and misses
Examples
# Sync all files
zeysdk sync
# Output:
Enhancement Sync
Services
| logger.ixml - deleted locally
Resources
| UserManager.ixml ~ properties modified: local
name: "User Manager" → "UserManager"
Weblets
| dashboard.ixml + created locally
# Sync specific files
zeysdk sync weblets/dashboard.ixml
# Output:
Weblets
| dashboard.ixml + created locally
# Force rehashing of all files
zeysdk sync --rehash
# Force sync without prompts
zeysdk sync -f
# Output:
Enhancement Sync
Services
| logger.ixml - deleted locally
Resources
| UserManager.ixml ~ properties modified: local
Weblets
| dashboard.ixml + created locally
Error Handling
| Error | Description | Resolution |
|---|---|---|
| Missing sync.json | No sync configuration | Run zeysdk link first |
| Invalid sync.json | Missing id/url | Relink instance |
| Network error | Server unreachable | Check connection |
| Auth error | Invalid/expired token | Auto-relinks |
| Merge conflict | Unresolved changes | Manual resolution |
| File system error | IO problems | Check permissions |