fix: Create automated sync script to ensure pull-before-push

CRITICAL FIX: The /sync command was not pulling remote changes before pushing,
causing machines to miss each other's work.

Changes:
- Created .claude/scripts/sync.sh (automated sync script)
- Created .claude/scripts/sync.bat (Windows wrapper)
- Updated .claude/commands/sync.md to use script

The script ensures:
1. Fetches remote changes FIRST
2. Pulls with rebase (conflict detection)
3. Then pushes local changes
4. Proper error handling
5. Clear status reporting

This fixes the issue where running /sync multiple times did not see
the Mac's changes until manual git fetch was run.

Both Windows and Mac will now use the same reliable sync script.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 19:59:32 -07:00
parent 3c673fdf8e
commit 27c76cafa4
3 changed files with 157 additions and 0 deletions

View File

@@ -4,6 +4,40 @@ Synchronize ClaudeTools configuration, session data, and context bidirectionally
---
## IMPORTANT: Use Automated Sync Script
**CRITICAL:** When user invokes `/sync`, execute the automated sync script instead of manual steps.
**Windows:**
```bash
bash .claude/scripts/sync.sh
```
OR
```cmd
.claude\scripts\sync.bat
```
**Mac/Linux:**
```bash
bash .claude/scripts/sync.sh
```
**Why use the script:**
- Ensures PULL happens BEFORE PUSH (prevents missing remote changes)
- Consistent behavior across all machines
- Proper error handling and conflict detection
- Automated timestamping and machine identification
- No steps can be accidentally skipped
**The script automatically:**
1. Checks for local changes
2. Commits local changes (if any)
3. **Fetches and pulls remote changes FIRST**
4. Pushes local changes
5. Reports sync status
---
## What Gets Synced
**FROM Local TO Gitea (PUSH):**