Some checks are pending
CI / test (map[image:macos-latest name:macos], 1, 4) (push) Waiting to run
CI / test (map[image:macos-latest name:macos], 2, 4) (push) Waiting to run
CI / test (map[image:macos-latest name:macos], 3, 4) (push) Waiting to run
CI / test (map[image:macos-latest name:macos], 4, 4) (push) Waiting to run
CI / test (map[image:windows-latest name:windows], 1, 4) (push) Waiting to run
CI / test (map[image:windows-latest name:windows], 2, 4) (push) Waiting to run
CI / test (map[image:windows-latest name:windows], 3, 4) (push) Waiting to run
CI / test (map[image:windows-latest name:windows], 4, 4) (push) Waiting to run
CI / merge-reports (push) Blocked by required conditions
5.4 KiB
5.4 KiB
Dyad Update Management Guide
This guide explains how to update your forked Dyad application while preserving your custom modifications.
🎯 Overview
Your setup uses a selective update strategy that:
- Keeps your custom code separate from the main codebase
- Automatically preserves custom modifications during updates
- Provides backup and rollback capabilities
- Minimizes merge conflicts
📁 Custom Code Structure
Your custom modifications are organized in src/custom/:
src/custom/
├── index.ts # Main entry point for custom features
├── hooks/
│ └── useSmartContext.ts # Custom smart context hook
├── ipc/
│ └── smart_context_handlers.ts # Custom IPC handlers
└── utils/
└── smart_context_store.ts # Custom utilities
🚀 Update Process
Method 1: Automated Update (Recommended)
Use the provided update script:
./update-dyad-v2.sh
What the script does:
- Creates a timestamped backup
- Backs up your custom code
- Fetches latest changes from upstream
- Resets to the latest upstream version
- Restores your custom code
- Pushes updates to your fork
Method 2: Manual Update
If you prefer manual control:
# 1. Create backup
cp -r src/custom/ dyad-backup-$(date +%Y%m%d-%H%M%S)/
# 2. Fetch latest changes
git fetch upstream
# 3. Reset to latest upstream
git reset --hard upstream/main
# 4. Restore custom code
cp -r dyad-backup-*/src/custom/ src/
# 5. Commit and push
git add src/custom/
git commit -m "Restore custom code after update"
git push origin main
🔄 Update Workflow
Before Updating
- Test current state - Ensure your app works properly
- Commit any changes - Don't have uncommitted work
- Check custom code - Note any modifications that might need updates
After Updating
- Run npm install - Update dependencies if needed
- Test the application - Ensure everything works
- Check custom integrations - Verify custom features still work
- Update custom code if needed - Adapt to any API changes
🛠️ Adding New Custom Features
When adding new custom features:
- Place in src/custom/ - Keep custom code organized
- Update imports - Use relative imports within custom directory
- Document changes - Note what each custom feature does
- Test integration - Ensure custom features work with main app
Example:
// src/custom/components/MyCustomComponent.tsx
import { useSmartContext } from '../hooks/useSmartContext';
export const MyCustomComponent = () => {
// Your custom logic
};
🚨 Troubleshooting
Merge Conflicts
If you encounter merge conflicts during manual updates:
# Abort the merge
git merge --abort
# Use the automated script instead
./update-dyad-v2.sh
Custom Code Not Working
After an update, if custom features don't work:
- Check API changes - The upstream may have changed interfaces
- Update imports - File paths might have changed
- Review breaking changes - Check upstream release notes
- Test incrementally - Isolate the problematic code
Backup Restoration
If you need to restore from backup:
# Find your backup directory
ls dyad-backup-*
# Restore specific files
cp -r dyad-backup-YYYYMMDD-HHMMSS/src/custom/ src/
# Or restore entire project (last resort)
rm -rf * .gitignore
cp -r dyad-backup-YYYYMMDD-HHMMSS/* .
cp dyad-backup-YYYYMMDD-HHMMSS/.gitignore .
📋 Best Practices
Regular Maintenance
- Update frequently - Smaller updates are easier to manage
- Test after each update - Catch issues early
- Keep custom code minimal - Only customize what's necessary
- Document customizations - Future you will thank you
Code Organization
- Separate concerns - Keep UI, logic, and utilities separate
- Use TypeScript - Catch integration issues early
- Follow existing patterns - Match the upstream code style
- Avoid modifying core files - Use extension patterns when possible
Backup Strategy
- Multiple backups - Keep several backup versions
- Offsite backup - Consider cloud storage for critical backups
- Test backups - Ensure you can restore from backup
- Label clearly - Use descriptive backup names
🔧 Advanced Configuration
Custom Update Script
You can modify update-dyad-v2.sh to:
- Skip certain files from backup
- Add custom post-update steps
- Include additional validation
- Send notifications on completion
Selective File Restoration
To restore only specific custom files:
# Restore specific directory
cp -r dyad-backup-*/src/custom/hooks/ src/custom/
# Restore specific file
cp dyad-backup-*/src/custom/index.ts src/custom/
📞 Getting Help
If you encounter issues:
- Check this guide first - Most common issues are covered
- Review the script output - Error messages are informative
- Test with a clean state - Start fresh if needed
- Document the issue - Note what you were trying to do
🎉 Success Indicators
You'll know the update was successful when:
- ✅ Script completes without errors
- ✅ Custom code is present in
src/custom/ - ✅ Application starts and runs normally
- ✅ Custom features work as expected
- ✅ No merge conflicts in git status
Remember: The goal is to make updates painless and predictable. When in doubt, use the automated script and keep good backups!