| name | sync-code |
| description | Audit which code version each lab server has for a project — commits, dirty trees, divergence — and align them safely. Use when results differ between servers or before launching a sweep. |
Sync code across servers
-
Locate the project on each reachable host: ask the user, or infer from
list_sessions cwds (and a targeted find if needed).
-
Audit per host (read-only, via run_command):
git -C <dir> rev-parse --abbrev-ref HEAD; git -C <dir> rev-parse --short HEAD; git -C <dir> status --porcelain | head -20; git -C <dir> log -1 --format='%cd %s' --date=short
-
Pick the baseline: the user's stated one, else the newest commit on the
shared remote. Table: host · branch · commit · dirty files ·
behind/ahead of baseline.
-
Propose per-host alignment commands. Safety rules:
- NEVER discard local work — dirty trees get
git stash push -m hopmux-sync-<date> first (and tell the user how to
pop it back).
- no
reset --hard, no checkout -- ., no force pushes.
- local commits that diverged from the baseline → report them; don't rebase
on your own.
-
Apply only what the user approves, host by host, and re-run the audit
line for each host you touched to confirm.
Report
End with either "all hosts aligned at ✓" or exactly which hosts still
differ and why (stashed changes, diverged commits awaiting a decision).