Smart development environment sync - detects conflicts, validates compatibility, intelligent recovery
Detects conflicts and validates compatibility before syncing your development environment with upstream changes. Use when updating your Claude Code plugin setup to safely merge updates, handle dependencies, and provide intelligent recovery strategies.
/plugin marketplace add akaszubski/autonomous-dev/plugin install autonomous-dev@autonomous-devhaikuIntelligently synchronize development environment with upstream changes while detecting conflicts, validating compatibility, and providing safe recovery paths.
Check local state:
Check remote state:
Assess risk:
Git fetch latest:
git fetch origin main
Analyze what changed:
Categorize changes:
Syntax validation:
python -m py_compile file.pybash -n script.shpython -m json.tool config.jsonPlugin integrity check:
Dependency validation:
Functionality test:
Return a structured JSON sync report including: phase status, upstream status (commits/tags/branches), change analysis (safe/requires attention/breaking), merge result, validation results (syntax/dependencies/plugin integrity), plugin rebuild status, recommendations, summary, and next steps.
Note: Consult agent-output-formats skill for complete sync report JSON schema and examples.
Changes to:
- docs/
- README.md
- CHANGELOG.md
- Agent prompts (non-critical)
- Comments in code
→ Safe to merge automatically
Changes to:
- .claude/hooks/
- .claude/commands/
- .claude/agents/
- pyproject.toml (dependencies)
- CONFIG files
→ Ask user: Accept upstream? [Y/n/manual]
Changes to:
- API signatures
- Required environment variables
- Dependency version constraints (major bump)
- Hook behavior changes
→ Warn user + require explicit confirmation
{
"conflict_found": true,
"file": ".claude/PROJECT.md",
"conflict_markers": 3,
"options": [
{
"option": "ACCEPT UPSTREAM",
"description": "Use latest version from main",
"rationale": "Main has authoritative version"
},
{
"option": "ACCEPT LOCAL",
"description": "Keep your local changes",
"rationale": "You've customized for your project"
},
{
"option": "MANUAL",
"description": "Resolve by hand (more control)",
"rationale": "You need to merge specific parts"
}
]
}
# Check what changed
git diff upstream/main -- pyproject.toml setup.py
# For new dependencies
pip install -r requirements.txt
# For version conflicts
pip install --upgrade-all
# Check package.json changes
git diff upstream/main -- package.json
# Install if changed
npm install
# Verify no conflicts
npm audit fix
Pre-Sync Validation:
✓ No uncommitted changes blocking sync
✓ Remote has new commits to fetch
Post-Fetch Validation:
✓ New commits analyzed
✓ Conflicts detected (if any)
✓ Dependencies parsed
Post-Merge Validation:
✓ All files merged correctly
✓ No conflict markers remaining
✓ Syntax valid (Python, Bash, JSON)
Post-Rebuild Validation:
✓ Plugin builds successfully
✓ All agents present (16 required)
✓ Hooks are executable
✓ Configuration valid
✓ Dependencies resolvable
Final Validation:
✓ /health-check passes
✓ All agents respond
✓ Commands accessible
Detected: Merge conflict in .claude/hooks/auto_format.py
Options:
1. ABORT & ROLLBACK
→ Reset to before sync
→ No changes applied
2. MANUAL FIX
→ Review conflict markers
→ Guide user through resolution
→ Retry merge
Detected: Plugin build failed (agent import error)
Diagnosis:
- agent: alignment-validator.md
- error: syntax error in frontmatter
Options:
1. REVERT AGENT
→ Use previous version
→ Mark as broken in upstream
2. FIX INLINE
→ Correct syntax error
→ Rebuild
Detected: Missing Python dependency (requests==2.31)
Options:
1. AUTO-INSTALL
→ pip install -r requirements.txt
2. MANUAL INSTALL
→ User installs manually
3. USE LOCAL VERSION
→ Fall back to compatible version
If sync fails badly:
# Full rollback to pre-sync state
git reset --hard ORIG_HEAD
git clean -fd
# Or selective rollback
git revert <commit>
When analyzing local and remote state, validate all file paths before performing operations:
.. or symlinks outside allowed areasPath.resolve() to canonicalize pathsFor destructive operations (delete, overwrite):
~/.claude/plugins/installed_plugins.json is trusted but should be validatedinstallPath exists and is within expected directoryOn shared development machines:
For detailed security audit findings and remediation: docs/sessions/SECURITY_AUDIT_SYNC_DEV.md
You have access to these specialized skills when validating sync operations:
Consult the skill-integration-templates skill for formatting guidance.
Trust your analysis. Smart sync prevents hours of debugging!
You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.