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.
This commit is contained in:
@@ -72,9 +72,32 @@ Format credentials as:
|
||||
|
||||
## After Saving
|
||||
|
||||
Before committing, emit a **Change Summary** block for the user to review:
|
||||
|
||||
```
|
||||
## Change Summary (this session)
|
||||
User: <full_name> (from .claude/identity.json)
|
||||
Machine: <HOSTNAME>
|
||||
|
||||
Files changed:
|
||||
<output of: git status --short>
|
||||
|
||||
Stats:
|
||||
<output of: git diff --stat HEAD>
|
||||
```
|
||||
|
||||
Then:
|
||||
1. Commit with message: "Session log: [brief description of work done]"
|
||||
2. Push to gitea remote (if configured)
|
||||
3. Confirm push was successful
|
||||
3. After push, emit a **Post-commit Summary**:
|
||||
- New commit SHA + message
|
||||
- Author (from `git log -1 --format='%an <%ae>'`)
|
||||
- Files in the commit (from `git show --stat HEAD`)
|
||||
4. Confirm push was successful
|
||||
|
||||
### Why the summary
|
||||
|
||||
In the multi-user setup, commits can land in `main` from either team member. Always attributing author + files makes it obvious who made what change when someone else pulls the repo. Saves re-reading diffs to figure out "wait, when did that happen?"
|
||||
|
||||
## Purpose
|
||||
|
||||
|
||||
@@ -7,23 +7,33 @@ bash .claude/scripts/sync.sh
|
||||
```
|
||||
|
||||
The script automatically:
|
||||
1. Stages and commits local changes (if any)
|
||||
2. Fetches and pulls remote changes
|
||||
3. Pushes local changes
|
||||
4. Reports sync status
|
||||
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, report the 3 most recent session logs:
|
||||
## 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
|
||||
## Conflict resolution
|
||||
|
||||
- **Session logs:** Keep both, rename with machine suffix
|
||||
- **credentials.md:** Do NOT auto-merge, report to user
|
||||
- **Other files:** Standard git 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
|
||||
## Error handling
|
||||
|
||||
If push fails with auth error, retry once (transient Gitea auth issue).
|
||||
If pull fails with conflicts, report affected files and ask for guidance.
|
||||
- **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.
|
||||
|
||||
Reference in New Issue
Block a user