Zum Hauptinhalt springen

Sync Files (zeysdk sync)

Synchronize local files with the ZeyOS server, handling bidirectional file synchronization and conflict resolution.

zeysdk sync [files...] [options]

Parameters

ParameterDescriptionRequiredExample
filesSpecific files to syncservices/backup.js

Options

OptionDescriptionDefault
-f, --forceSkip sync confirmationsfalse
--rehashForce rehashing of all filesfalse
--verboseShow detailed sync progressfalse

Status Indicators

SymbolMeaning
+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:

  1. Content Conflicts

    ! Modified locally and on server
    > Take server version
    > Take local version
    > Merge changes
    > Skip file
  2. 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:

  1. 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
  2. Manual Rehashing: Use the --rehash flag to force rehashing of all files, which is useful when:

    • Timestamps are unreliable
    • You suspect hash inconsistencies
    • After manually editing files outside the SDK
  3. Verbose Logging: Use --verbose to 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

ErrorDescriptionResolution
Missing sync.jsonNo sync configurationRun zeysdk link first
Invalid sync.jsonMissing id/urlRelink instance
Network errorServer unreachableCheck connection
Auth errorInvalid/expired tokenAuto-relinks
Merge conflictUnresolved changesManual resolution
File system errorIO problemsCheck permissions