# Install Script Collision Handling - Quick Reference ## 🎯 What Changed The install script now **detects file collisions** before installing and gives you **4 clear options**. --- ## πŸ“Š The Flow ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Select Components to Install β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Scan for Existing Files β”‚ β”‚ (Check what would be overwritten) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β” β”‚ Collisions? β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ NO YES β”‚ β”‚ β–Ό β–Ό Install β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” Everything β”‚ Show Report β”‚ β”‚ Ask User Choice β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Skip β”‚ β”‚Overwrite β”‚ β”‚ Backup & β”‚ β”‚ Cancel β”‚ β”‚Existingβ”‚ β”‚ All β”‚ β”‚Overwrite β”‚ β”‚ β”‚ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β–Ό Install Install All Backup Files Exit New Only (Replace) Then Install ``` --- ## 🎨 The 4 Options Explained ### Option 1: Skip Existing βœ… (SAFEST) ``` What happens: βœ“ New files β†’ Installed βœ“ Existing files β†’ Untouched βœ“ Your changes β†’ Preserved Use when: β€’ You've customized files β€’ You only want new components β€’ You're doing incremental updates Example: 10 selected, 5 exist β†’ 5 installed, 5 skipped ``` ### Option 2: Overwrite All ⚠️ (DESTRUCTIVE) ``` What happens: βœ“ New files β†’ Installed βœ“ Existing files β†’ REPLACED βœ— Your changes β†’ LOST Use when: β€’ You want latest versions β€’ You haven't customized anything β€’ You want to reset to defaults Requires: Type 'yes' to confirm Example: 10 selected, 5 exist β†’ 10 installed (5 new, 5 replaced) ``` ### Option 3: Backup & Overwrite πŸ”„ (RECOMMENDED) ``` What happens: βœ“ Existing files β†’ Backed up βœ“ New files β†’ Installed βœ“ Existing files β†’ Replaced βœ“ Backup β†’ Available for restore Use when: β€’ You want new versions β€’ You want safety net β€’ You're not sure about changes Backup location: .opencode.backup.YYYYMMDD-HHMMSS/ Example: 10 selected, 5 exist β†’ 5 backed up β†’ 10 installed (5 new, 5 replaced) ``` ### Option 4: Cancel ❌ ``` What happens: β€’ Nothing changes β€’ Exit cleanly Use when: β€’ You need to review first β€’ You want manual backup β€’ You're not ready ``` --- ## πŸ“‹ Collision Report Example ``` ⚠ Found 8 file collision(s): Agents (2): .opencode/agent/core/task-manager.md .opencode/agent/core/opencoder.md Subagents (3): .opencode/agent/subagents/reviewer.md .opencode/agent/subagents/tester.md .opencode/agent/subagents/coder-agent.md Commands (2): .opencode/command/test.md .opencode/command/commit.md Context (1): .opencode/context/core/essential-patterns.md ``` **Clear, organized, easy to review!** --- ## πŸš€ Quick Decision Guide | Your Situation | Best Option | Why | |----------------|-------------|-----| | First install | Any (no collisions) | Nothing exists yet | | Adding new components | **Option 1: Skip** | Keeps your customizations | | Want latest versions | **Option 3: Backup** | Safe update with rollback | | Reset to defaults | **Option 2: Overwrite** | Clean slate (careful!) | | Not sure | **Option 4: Cancel** | Review and decide later | --- ## πŸ’‘ Pro Tips ### Restore from Backup ```bash # List backups ls -la .opencode.backup.*/ # Restore one file cp .opencode.backup.20251118-143022/.opencode/agent/my-agent.md .opencode/agent/ # Restore everything rm -rf .opencode mv .opencode.backup.20251118-143022/.opencode .opencode ``` ### Update One File Only ```bash # Delete the file you want to update rm .opencode/agent/task-manager.md # Run installer with "Skip existing" # Only the deleted file gets reinstalled ``` ### See What Changed ```bash # Compare with backup diff .opencode/agent/my-agent.md .opencode.backup.*/agent/my-agent.md # Or use git git diff .opencode/ ``` --- ## βœ… Benefits | Before | After | |--------|-------| | ❌ Always overwrites | βœ… Asks first | | ❌ All-or-nothing | βœ… Flexible strategies | | ❌ No visibility | βœ… Clear collision report | | ❌ No backup option | βœ… Optional backup | | ❌ Risky updates | βœ… Safe incremental updates | --- ## 🎯 Summary **The install script is now smart:** 1. **Detects** what would be overwritten 2. **Reports** collisions clearly 3. **Asks** how you want to proceed 4. **Respects** your choice 5. **Protects** your work **You're in control!** πŸŽ‰