|
| 1 | +# Updating the Framework |
| 2 | + |
| 3 | +This guide explains how to keep your OpenCode framework installation up to date, switch between installation modes, and troubleshoot common issues. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Updating the Framework |
| 8 | + |
| 9 | +### Copy Mode |
| 10 | + |
| 11 | +In copy mode, the framework is downloaded and extracted without git tracking. To update: |
| 12 | + |
| 13 | +```bash |
| 14 | +curl -fsSL https://apiad.github.io/opencode/install.sh | bash |
| 15 | +``` |
| 16 | + |
| 17 | +The installer will: |
| 18 | +1. Detect the existing `.opencode/` directory |
| 19 | +2. Clone the latest version from the repository |
| 20 | +3. Preserve your protected files (`opencode.json`, `.opencode/style-guide.md`) |
| 21 | +4. Show you what will be updated before proceeding |
| 22 | + |
| 23 | +To update to a specific version: |
| 24 | + |
| 25 | +```bash |
| 26 | +curl -fsSL https://apiad.github.io/opencode/install.sh | bash -s -- --version v2.0.0 |
| 27 | +``` |
| 28 | + |
| 29 | +### Link Mode (Submodule) |
| 30 | + |
| 31 | +In link mode, the framework is installed as a git submodule. To update: |
| 32 | + |
| 33 | +```bash |
| 34 | +cd .opencode && git fetch && git checkout vX.Y.Z |
| 35 | +``` |
| 36 | + |
| 37 | +Or use the installer to update the submodule: |
| 38 | + |
| 39 | +```bash |
| 40 | +curl -fsSL https://apiad.github.io/opencode/install.sh | bash -s -- --mode=link --update |
| 41 | +``` |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Switching Between Modes |
| 46 | + |
| 47 | +### Copy → Link |
| 48 | + |
| 49 | +Run the installer with `--mode=link`: |
| 50 | + |
| 51 | +```bash |
| 52 | +curl -fsSL https://apiad.github.io/opencode/install.sh | bash -s -- --mode=link |
| 53 | +``` |
| 54 | + |
| 55 | +> **Warning:** This will convert your installation to a git submodule. The installer will prompt for confirmation. |
| 56 | +
|
| 57 | +### Link → Copy |
| 58 | + |
| 59 | +Run the installer with `--mode=copy`: |
| 60 | + |
| 61 | +```bash |
| 62 | +curl -fsSL https://apiad.github.io/opencode/install.sh | bash -s -- --mode=copy |
| 63 | +``` |
| 64 | + |
| 65 | +> **Warning:** This will remove the `.git/` directory from the framework, breaking the submodule connection. Your customizations will be preserved. |
| 66 | +
|
| 67 | +--- |
| 68 | + |
| 69 | +## Updating opencode-core |
| 70 | + |
| 71 | +### For Link Mode |
| 72 | + |
| 73 | +The framework repository (`opencode-core`) is tracked as a submodule. To update to a specific version: |
| 74 | + |
| 75 | +```bash |
| 76 | +cd .opencode |
| 77 | +git fetch origin |
| 78 | +git checkout v2.0.0 |
| 79 | +cd .. |
| 80 | +git add .opencode |
| 81 | +git commit -m "chore: update opencode-core to v2.0.0" |
| 82 | +``` |
| 83 | + |
| 84 | +To switch back to the latest from a branch: |
| 85 | + |
| 86 | +```bash |
| 87 | +cd .opencode |
| 88 | +git checkout main |
| 89 | +``` |
| 90 | + |
| 91 | +### For Copy Mode |
| 92 | + |
| 93 | +Simply re-run the installer. It will download the latest version and preserve your configurations. |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## Troubleshooting |
| 98 | + |
| 99 | +### Updates Break Things |
| 100 | + |
| 101 | +If an update causes issues: |
| 102 | + |
| 103 | +1. **Check the changelog** - Review `.opencode/CHANGELOG.md` for breaking changes |
| 104 | +2. **Run diagnostics**: |
| 105 | + ```bash |
| 106 | + make doctor |
| 107 | + ``` |
| 108 | +3. **Check for dependency updates**: |
| 109 | + ```bash |
| 110 | + make install-deps |
| 111 | + ``` |
| 112 | + |
| 113 | +### Rolling Back |
| 114 | + |
| 115 | +#### Copy Mode Rollback |
| 116 | + |
| 117 | +Since copy mode doesn't track git history, you cannot rollback automatically. To restore a previous state: |
| 118 | + |
| 119 | +1. Identify the version you need from the installer changelog |
| 120 | +2. Reinstall that specific version: |
| 121 | + ```bash |
| 122 | + curl -fsSL https://apiad.github.io/opencode/install.sh | bash -s -- --version v1.9.0 |
| 123 | + ``` |
| 124 | + |
| 125 | +#### Link Mode Rollback |
| 126 | + |
| 127 | +Git submodules preserve history. To rollback: |
| 128 | + |
| 129 | +```bash |
| 130 | +cd .opencode |
| 131 | +git log --oneline # Find the previous commit |
| 132 | +git checkout v1.9.0 # Rollback to previous version |
| 133 | +cd .. |
| 134 | +git add .opencode |
| 135 | +git commit -m "chore: rollback opencode-core to v1.9.0" |
| 136 | +``` |
| 137 | + |
| 138 | +To find available versions: |
| 139 | + |
| 140 | +```bash |
| 141 | +cd .opencode |
| 142 | +git tag -l # List all available versions |
| 143 | +``` |
| 144 | + |
| 145 | +### Stuck in Broken State |
| 146 | + |
| 147 | +If your installation is corrupted: |
| 148 | + |
| 149 | +1. **Remove the framework directory:** |
| 150 | + ```bash |
| 151 | + rm -rf .opencode |
| 152 | + ``` |
| 153 | + |
| 154 | +2. **Reinstall:** |
| 155 | + ```bash |
| 156 | + curl -fsSL https://apiad.github.io/opencode/install.sh | bash -s -- --mode=copy |
| 157 | + ``` |
| 158 | + |
| 159 | +3. **Restore your configurations** from backups (if available in `~/.opencode/`) |
| 160 | + |
| 161 | +--- |
| 162 | + |
| 163 | +## Getting Help |
| 164 | + |
| 165 | +- **Documentation:** See other files in `/docs/` |
| 166 | +- **Issues:** Report bugs at https://github.com/apiad/opencode/issues |
| 167 | +- **Framework Repo:** https://github.com/apiad/opencode-core |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +*See [deploy.md](deploy.md) for information about installation modes and when to use each.* |
0 commit comments