Files
claudetools/.claude/commands/sync.md
Mike Swanson 6f6a77f8e4 Session log: /save + /sync multi-user change summaries
Enhance /save and /sync slash commands to attribute commits by author
so Mike and Howard can see at a glance what the other person did.

- sync.sh: loads identity.json, shows incoming/outgoing commits with
  author + age before pull/push, groups by author in final summary
- sync.md: describes the new output format + conflict attribution
- save.md: pre-commit Change Summary block + post-commit Summary

Motivation: repo is now shared across team, `git log` alone made it
hard to see "when did Howard change that?" without hunting.
2026-04-16 19:08:25 -07:00

40 lines
1.9 KiB
Markdown

# /sync - Bidirectional ClaudeTools Sync
Run the automated sync script:
```bash
bash .claude/scripts/sync.sh
```
The script automatically:
1. Stages and commits local changes (attributed to the current user from `.claude/identity.json`)
2. Fetches remote and shows **incoming commits with authors** before pulling
3. Shows **outgoing commits with authors** before pushing
4. Pulls (rebase), then pushes
5. Prints a final change summary (who committed what, on which side)
## After the script completes
The script emits a "Sync Summary" block. Relay the key bits to the user:
- **Incoming from remote:** N commits. If N > 0, list commits as `<short-sha> <author> — <message>` so the user immediately sees what Howard / Mike / other teammates pushed since their last sync.
- **Outgoing to remote:** M commits by the current user (this is what they're publishing).
- **Net file changes in this sync:** output of `git diff --stat <prev-HEAD>..HEAD -- . ':(exclude)session-logs'` (or similar scoping) so the user sees the meaningful edits, not noise.
Then report the 3 most recent session logs:
```bash
ls -t session-logs/*.md projects/*/session-logs/*.md clients/*/session-logs/*.md 2>/dev/null | head -3
```
## Conflict resolution
- **Session logs:** Keep both, rename with machine suffix. Note which user authored each conflicting side.
- **credentials.md:** Do NOT auto-merge, report to user.
- **Other files:** Standard git conflict resolution. When presenting a conflict, include the author of the conflicting commits on each side so the user can coordinate (e.g., "Howard changed this in commit abc123 on 2026-04-15").
## Error handling
- **Auth failure on push:** retry once (transient Gitea auth issue).
- **Pull conflicts:** report affected files + author of each conflicting side, then ask for guidance.
- **No identity.json yet:** follow the onboarding flow in CLAUDE.md before syncing.