fix: Update /sync command to use HTTPS instead of SSH for Gitea
Changed Gitea repository URL from SSH to HTTPS format for better compatibility across different machines and authentication setups. URL change: git@git.azcomputerguru.com → https://git.azcomputerguru.com Also simplified the command documentation to focus on practical steps rather than extensive technical implementation details. Files modified: - .claude/commands/sync.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,260 +1,36 @@
|
||||
# /sync Command
|
||||
Sync Claude Code preferences and commands from ClaudeTools repo on Gitea to this local machine.
|
||||
|
||||
Synchronize ClaudeTools configuration from Gitea repository.
|
||||
## Steps to perform:
|
||||
|
||||
## Purpose
|
||||
1. **Pull the ClaudeTools repo** from Gitea via HTTPS:
|
||||
```
|
||||
Repository: https://git.azcomputerguru.com/azcomputerguru/claudetools.git
|
||||
```
|
||||
|
||||
Pull the latest system configuration, agent definitions, and workflows from the Gitea repository to ensure you're working with the most up-to-date ClaudeTools system.
|
||||
2. **Check if repo exists locally** at `~/ClaudeTools/`
|
||||
- If exists: `git pull origin main`
|
||||
- If not: Clone it first with `git clone https://git.azcomputerguru.com/azcomputerguru/claudetools.git ~/ClaudeTools`
|
||||
|
||||
## What It Does
|
||||
3. **Copy the .claude/commands directory** from the repo to apply commands:
|
||||
- Source: `~/ClaudeTools/.claude/commands/`
|
||||
- Destination: `~/.claude/commands/`
|
||||
- These slash commands will now be available globally
|
||||
|
||||
1. **Connects to Gitea repository** - `azcomputerguru/claudetools`
|
||||
2. **Pulls latest changes** - Via Gitea Agent
|
||||
3. **Updates local files**:
|
||||
- `.claude/agents/` - Agent definitions
|
||||
- `.claude/commands/` - Custom commands
|
||||
- `.claude/*.md` - Workflow documentation
|
||||
- `README.md` - System overview
|
||||
4. **Handles conflicts** - Stashes local changes if needed
|
||||
5. **Reports changes** - Shows what was updated
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/sync
|
||||
```
|
||||
|
||||
Or:
|
||||
```
|
||||
Claude, sync the settings
|
||||
Claude, pull latest from Gitea
|
||||
Claude, update claudetools config
|
||||
```
|
||||
|
||||
## When to Use
|
||||
|
||||
- **After repository updates** - When changes pushed to Gitea
|
||||
- **On new machine** - After cloning repository
|
||||
- **Periodic checks** - Weekly sync to stay current
|
||||
- **Team updates** - When other team members update agents/workflows
|
||||
- **Before important work** - Ensure latest configurations
|
||||
|
||||
## What Gets Updated
|
||||
|
||||
✅ **System Configuration:**
|
||||
- `.claude/agents/*.md` - Agent definitions
|
||||
- `.claude/commands/*.md` - Custom commands
|
||||
- `.claude/*.md` - Workflow documentation
|
||||
|
||||
✅ **Documentation:**
|
||||
- `README.md` - System overview
|
||||
- `.gitignore` - Git ignore rules
|
||||
|
||||
❌ **NOT Updated (Local Only):**
|
||||
- `.claude/settings.local.json` - Machine-specific settings
|
||||
- `backups/` - Local backups
|
||||
- `clients/` - Client work (separate repos)
|
||||
- `projects/` - Projects (separate repos)
|
||||
|
||||
## Execution Flow
|
||||
|
||||
```
|
||||
User: "/sync"
|
||||
↓
|
||||
Main Claude: Invokes Gitea Agent
|
||||
↓
|
||||
Gitea Agent:
|
||||
1. cd D:\ClaudeTools
|
||||
2. git fetch origin main
|
||||
3. Check for local changes
|
||||
4. If clean: git pull origin main
|
||||
5. If dirty: git stash && git pull && git stash pop
|
||||
6. Report results
|
||||
↓
|
||||
Main Claude: Shows summary to user
|
||||
```
|
||||
|
||||
## Example Output
|
||||
|
||||
```markdown
|
||||
## Sync Complete ✅
|
||||
|
||||
**Repository:** azcomputerguru/claudetools
|
||||
**Branch:** main
|
||||
**Changes:** 3 files updated
|
||||
|
||||
### Files Updated:
|
||||
- `.claude/agents/coding.md` - Updated coding standards
|
||||
- `.claude/CODE_WORKFLOW.md` - Added exception handling notes
|
||||
- `README.md` - Updated backup strategy documentation
|
||||
|
||||
### Status:
|
||||
- No conflicts
|
||||
- Local changes preserved (if any)
|
||||
- Ready to continue work
|
||||
|
||||
**Last sync:** 2026-01-15 15:30:00
|
||||
```
|
||||
|
||||
## Conflict Handling
|
||||
|
||||
**If local changes conflict with remote:**
|
||||
|
||||
1. **Stash local changes**
|
||||
4. **Apply global permissions** - Copy the shared settings if available:
|
||||
```bash
|
||||
git stash save "Auto-stash before /sync command"
|
||||
cp ~/ClaudeTools/.claude/settings.json ~/.claude/settings.json
|
||||
```
|
||||
This applies the comprehensive permission set so you get fewer prompts.
|
||||
|
||||
2. **Pull remote changes**
|
||||
```bash
|
||||
git pull origin main
|
||||
```
|
||||
5. **Read and apply any project settings** from `~/ClaudeTools/.claude/settings.local.json` if present
|
||||
|
||||
3. **Attempt to restore local changes**
|
||||
```bash
|
||||
git stash pop
|
||||
```
|
||||
6. **Report what was synced**:
|
||||
- List available slash commands
|
||||
- Show any settings applied
|
||||
- Show recent session logs available for context
|
||||
|
||||
4. **If conflicts remain:**
|
||||
```markdown
|
||||
## Sync - Manual Intervention Required ⚠️
|
||||
7. **Read the most recent session log** from `~/ClaudeTools/session-logs/` to get context on what was worked on recently
|
||||
|
||||
**Conflict detected in:**
|
||||
- `.claude/agents/coding.md`
|
||||
8. **Refresh directives** - Read directives.md to ensure proper operational mode
|
||||
|
||||
**Action required:**
|
||||
1. Open conflicted file
|
||||
2. Resolve conflict markers (<<<<<<, ======, >>>>>>)
|
||||
3. Run: git add .claude/agents/coding.md
|
||||
4. Run: git stash drop
|
||||
5. Or ask Claude to help resolve conflict
|
||||
|
||||
**Local changes stashed** - Run `git stash list` to see
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Network Error
|
||||
```markdown
|
||||
## Sync Failed - Network Issue ❌
|
||||
|
||||
Could not connect to git.azcomputerguru.com
|
||||
|
||||
**Possible causes:**
|
||||
- VPN not connected
|
||||
- Network connectivity issue
|
||||
- Gitea server down
|
||||
|
||||
**Solution:**
|
||||
- Check VPN connection
|
||||
- Retry: /sync
|
||||
```
|
||||
|
||||
### Authentication Error
|
||||
```markdown
|
||||
## Sync Failed - Authentication ❌
|
||||
|
||||
SSH key authentication failed
|
||||
|
||||
**Possible causes:**
|
||||
- SSH key not loaded
|
||||
- Incorrect permissions on key file
|
||||
|
||||
**Solution:**
|
||||
- Verify SSH key: C:\Users\MikeSwanson\.ssh\id_ed25519
|
||||
- Test connection: ssh git@git.azcomputerguru.com
|
||||
```
|
||||
|
||||
### Uncommitted Changes Warning
|
||||
```markdown
|
||||
## Sync Warning - Uncommitted Changes ⚠️
|
||||
|
||||
You have uncommitted local changes:
|
||||
- `.claude/agents/custom-agent.md` (new file)
|
||||
- `.claude/CUSTOM_NOTES.md` (modified)
|
||||
|
||||
**Options:**
|
||||
1. Commit changes first: `/commit` or ask Claude to commit
|
||||
2. Stash and sync: /sync will auto-stash
|
||||
3. Discard changes: git reset --hard (WARNING: loses changes)
|
||||
|
||||
**Recommended:** Commit your changes first, then sync.
|
||||
```
|
||||
|
||||
## Integration with Gitea Agent
|
||||
|
||||
**Sync operation delegated to Gitea Agent:**
|
||||
|
||||
```python
|
||||
# Main Claude (Orchestrator) calls:
|
||||
Gitea_Agent.sync_from_remote(
|
||||
repository="azcomputerguru/claudetools",
|
||||
base_path="D:/ClaudeTools/",
|
||||
branch="main",
|
||||
handle_conflicts="auto-stash"
|
||||
)
|
||||
|
||||
# Gitea Agent performs:
|
||||
# 1. git fetch
|
||||
# 2. Check status
|
||||
# 3. Stash if needed
|
||||
# 4. Pull
|
||||
# 5. Pop stash if stashed
|
||||
# 6. Report results
|
||||
```
|
||||
|
||||
## Safety Features
|
||||
|
||||
- **No data loss** - Local changes stashed, not discarded
|
||||
- **Conflict detection** - User notified if manual resolution needed
|
||||
- **Rollback possible** - `git stash list` shows saved changes
|
||||
- **Dry-run option** - `git fetch` previews changes before pulling
|
||||
|
||||
## Related Commands
|
||||
|
||||
- `/commit` - Commit local changes before sync
|
||||
- `/status` - Check git status without syncing
|
||||
|
||||
## Technical Implementation
|
||||
|
||||
**Gitea Agent receives:**
|
||||
```json
|
||||
{
|
||||
"operation": "sync_from_remote",
|
||||
"repository": "azcomputerguru/claudetools",
|
||||
"base_path": "D:/ClaudeTools/",
|
||||
"branch": "main",
|
||||
"handle_conflicts": "auto-stash"
|
||||
}
|
||||
```
|
||||
|
||||
**Gitea Agent returns:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"operation": "sync_from_remote",
|
||||
"files_updated": [
|
||||
".claude/agents/coding.md",
|
||||
".claude/CODE_WORKFLOW.md",
|
||||
"README.md"
|
||||
],
|
||||
"files_count": 3,
|
||||
"conflicts": false,
|
||||
"local_changes_stashed": false,
|
||||
"commit_before": "a3f5b92c...",
|
||||
"commit_after": "e7d9c1a4...",
|
||||
"sync_timestamp": "2026-01-15T15:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Sync regularly** - Weekly or before important work
|
||||
2. **Commit before sync** - Cleaner workflow, easier conflict resolution
|
||||
3. **Review changes** - Check what was updated after sync
|
||||
4. **Test after sync** - Verify agents/workflows work as expected
|
||||
5. **Keep local settings separate** - Use `.claude/settings.local.json` for machine-specific config
|
||||
|
||||
---
|
||||
|
||||
**This command ensures you always have the latest ClaudeTools configuration and agent definitions.**
|
||||
This ensures all your machines have the same Claude Code setup and can pick up where you left off with ClaudeTools work.
|
||||
|
||||
Reference in New Issue
Block a user