Re-implements the upstream features lost during the six-bundle rebase,
on top of the refactored SkillRepository/SkillSync seams:
- SkillRepositoryFile carries mtimeMs; walkSkillFiles collects it.
- DOWN pass: local drift and name collisions auto-resolve by content
and modification time (identical bytes adopt the cloud identity; a
clearly newer side wins, the losing local copy is backed up under
C:\Users\qyh15\.dsh/.dsh-brain-backups/sync/); equal or missing timestamps
stay human conflicts.
- UP pass: identical cloud bytes re-pin or adopt the revision without
an upload; revision drift picks the newer side; a conflict flagged
in the DOWN pass is not double-reported.
- resolveConflicts(action) resolves every current conflict with one
keep_local/take_cloud action, collecting per-item failures.
- POST /dsh-brain/sync/resolve-all serves the batch over the routes
bundle; verify-sync-resolve.mjs wires the second scenario through
the repository seam like the first (SkillSync now requires it).
The skill bundle now owns the directory format helpers (skills/shared.ts), the local skill file store (skills/repository.ts) and publishes the SkillRepository/SkillSyncGate contracts; the sync engine keeps the cloud protocol, sidecar state and conflict policy, touching the disk only through the repository. Format helpers stay re-exported from skill-sync.ts so existing import sites keep working.