opencode-github-sync 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +379 -160
- package/README.zh-CN.md +261 -101
- package/dist/cli/i18n.d.ts +10 -0
- package/dist/cli/i18n.d.ts.map +1 -1
- package/dist/cli/i18n.js +24 -4
- package/dist/cli/i18n.js.map +1 -1
- package/dist/cli/index.js +50 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/core/autosync.d.ts +2 -0
- package/dist/core/autosync.d.ts.map +1 -1
- package/dist/core/autosync.js +9 -0
- package/dist/core/autosync.js.map +1 -1
- package/dist/core/categories.js +1 -1
- package/dist/core/categories.js.map +1 -1
- package/dist/core/credentials.d.ts +40 -0
- package/dist/core/credentials.d.ts.map +1 -0
- package/dist/core/credentials.js +364 -0
- package/dist/core/credentials.js.map +1 -0
- package/dist/core/fsx.d.ts +2 -0
- package/dist/core/fsx.d.ts.map +1 -1
- package/dist/core/fsx.js +6 -0
- package/dist/core/fsx.js.map +1 -1
- package/dist/core/lease.d.ts +52 -0
- package/dist/core/lease.d.ts.map +1 -0
- package/dist/core/lease.js +235 -0
- package/dist/core/lease.js.map +1 -0
- package/dist/core/projects.d.ts +90 -0
- package/dist/core/projects.d.ts.map +1 -0
- package/dist/core/projects.js +225 -0
- package/dist/core/projects.js.map +1 -0
- package/dist/core/repair.d.ts +44 -0
- package/dist/core/repair.d.ts.map +1 -0
- package/dist/core/repair.js +81 -0
- package/dist/core/repair.js.map +1 -0
- package/dist/core/repo.d.ts +20 -2
- package/dist/core/repo.d.ts.map +1 -1
- package/dist/core/repo.js +65 -3
- package/dist/core/repo.js.map +1 -1
- package/dist/core/rows.d.ts +36 -0
- package/dist/core/rows.d.ts.map +1 -0
- package/dist/core/rows.js +75 -0
- package/dist/core/rows.js.map +1 -0
- package/dist/core/sessions.d.ts +34 -4
- package/dist/core/sessions.d.ts.map +1 -1
- package/dist/core/sessions.js +352 -104
- package/dist/core/sessions.js.map +1 -1
- package/dist/core/settings.d.ts +6 -0
- package/dist/core/settings.d.ts.map +1 -1
- package/dist/core/settings.js +1 -0
- package/dist/core/settings.js.map +1 -1
- package/dist/core/sqlite.d.ts +2 -0
- package/dist/core/sqlite.d.ts.map +1 -1
- package/dist/core/sqlite.js +14 -0
- package/dist/core/sqlite.js.map +1 -1
- package/dist/core/stage.d.ts +14 -1
- package/dist/core/stage.d.ts.map +1 -1
- package/dist/core/stage.js +63 -3
- package/dist/core/stage.js.map +1 -1
- package/dist/core/sync.d.ts.map +1 -1
- package/dist/core/sync.js +69 -16
- package/dist/core/sync.js.map +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +2 -2
- package/dist/plugin/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,218 +1,274 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/
|
|
2
|
+
<img src="https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/docs/images/en/01-hero.png" alt="opencode-github-sync: one config, every machine" width="880">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/opencode-github-sync"><img alt="npm" src="https://img.shields.io/npm/v/opencode-github-sync?style=flat-square&color=7aa2f7&labelColor=1a1e2b"></a>
|
|
7
|
-
<a href="https://github.com/
|
|
8
|
-
<a href="https://github.com/
|
|
7
|
+
<a href="https://github.com/lazyalex616/opencode-github-sync/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/lazyalex616/opencode-github-sync/ci.yml?style=flat-square&color=9ece6a&labelColor=1a1e2b&label=ci"></a>
|
|
8
|
+
<a href="https://github.com/lazyalex616/opencode-github-sync/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-bb9af7?style=flat-square&labelColor=1a1e2b"></a>
|
|
9
9
|
<img alt="platform" src="https://img.shields.io/badge/macOS%20·%20Windows%20·%20Linux-9ece6a?style=flat-square&labelColor=1a1e2b&label=runs%20on">
|
|
10
|
+
<img alt="OpenCode" src="https://img.shields.io/badge/OpenCode-1.x%20·%202.x-e0af68?style=flat-square&labelColor=1a1e2b">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<b>English</b> · <a href="./README.zh-CN.md">简体中文</a>
|
|
10
15
|
</p>
|
|
11
16
|
|
|
12
17
|
<p align="center">
|
|
13
|
-
<a href="https://github.com/doomsday616/opencode-github-sync/blob/main/README.zh-CN.md">简体中文</a>
|
|
14
|
-
·
|
|
15
18
|
<a href="#install">Install</a>
|
|
16
19
|
·
|
|
17
|
-
<a href="#
|
|
20
|
+
<a href="#first-run">First run</a>
|
|
21
|
+
·
|
|
22
|
+
<a href="#what-gets-synced">What gets synced</a>
|
|
23
|
+
·
|
|
24
|
+
<a href="#opencode-2">OpenCode 2</a>
|
|
18
25
|
·
|
|
19
|
-
<a href="#
|
|
26
|
+
<a href="#autosync">Autosync</a>
|
|
20
27
|
·
|
|
21
|
-
<a href="#
|
|
28
|
+
<a href="#commands">Commands</a>
|
|
22
29
|
·
|
|
23
30
|
<a href="#troubleshooting">Troubleshooting</a>
|
|
24
31
|
</p>
|
|
25
32
|
|
|
26
33
|
---
|
|
27
34
|
|
|
28
|
-
You use OpenCode on more than one computer
|
|
29
|
-
|
|
35
|
+
You use OpenCode on more than one computer, and every machine drifts: a new
|
|
36
|
+
agent here, an MCP server there, a skill you installed on the laptop and forgot
|
|
37
|
+
on the desktop.
|
|
38
|
+
|
|
39
|
+
**opencode-github-sync** keeps all of them on one setup through a private
|
|
40
|
+
GitHub repository. Run it by hand when you want, or let your everyday machines
|
|
41
|
+
sync themselves in the background. It works with OpenCode 1 and OpenCode 2,
|
|
42
|
+
and both can share the same repository.
|
|
43
|
+
|
|
44
|
+
**What you get**
|
|
45
|
+
|
|
46
|
+
- Config, instruction files, agents, commands, plugins, themes and skills on
|
|
47
|
+
every machine.
|
|
48
|
+
- Optionally your logins and your recent conversations, too.
|
|
49
|
+
- Settings that belong to one machine stay on that machine.
|
|
50
|
+
- Nothing is overwritten without a copy kept first, and a broken sync can be
|
|
51
|
+
repaired from the command line even when OpenCode will not start.
|
|
52
|
+
|
|
53
|
+
## Contents
|
|
54
|
+
|
|
55
|
+
- [Install](#install)
|
|
56
|
+
- [First run](#first-run)
|
|
57
|
+
- [What gets synced](#what-gets-synced)
|
|
58
|
+
- [OpenCode 2](#opencode-2)
|
|
59
|
+
- [Autosync](#autosync)
|
|
60
|
+
- [Per-machine overrides](#per-machine-overrides)
|
|
61
|
+
- [Sessions](#sessions)
|
|
62
|
+
- [Credentials](#credentials)
|
|
63
|
+
- [Safety](#safety)
|
|
64
|
+
- [The menu](#the-menu)
|
|
65
|
+
- [OpenCode plugin](#opencode-plugin)
|
|
66
|
+
- [Commands](#commands)
|
|
67
|
+
- [Settings file](#settings-file)
|
|
68
|
+
- [Troubleshooting](#troubleshooting)
|
|
69
|
+
- [Upgrading](#upgrading)
|
|
70
|
+
- [Development](#development)
|
|
30
71
|
|
|
31
|
-
|
|
32
|
-
private GitHub repository. Run it by hand, or let one machine sync itself in
|
|
33
|
-
the background.
|
|
72
|
+
---
|
|
34
73
|
|
|
35
74
|
## Install
|
|
36
75
|
|
|
37
76
|
**macOS / Linux**
|
|
38
77
|
|
|
39
78
|
```bash
|
|
40
|
-
curl -fsSL https://raw.githubusercontent.com/
|
|
79
|
+
curl -fsSL https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/install.sh | sh
|
|
41
80
|
```
|
|
42
81
|
|
|
43
82
|
**Windows** (PowerShell 5.1 or 7)
|
|
44
83
|
|
|
45
84
|
```powershell
|
|
46
|
-
irm https://raw.githubusercontent.com/
|
|
85
|
+
irm https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/install.ps1 | iex
|
|
47
86
|
```
|
|
48
87
|
|
|
49
88
|
The installer checks for Node.js 18+ and git. If one is missing it shows the
|
|
50
89
|
command that would install it and asks before running anything. Then it runs
|
|
51
90
|
`npm install -g opencode-github-sync@latest` and opens the menu.
|
|
52
91
|
|
|
53
|
-
Already have Node.js?
|
|
54
|
-
|
|
92
|
+
Already have Node.js? This does the same:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm install -g opencode-github-sync
|
|
96
|
+
opencode-sync
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Requirements**
|
|
100
|
+
|
|
101
|
+
| | Needed for |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| Node.js 18 or newer | everything |
|
|
104
|
+
| Node.js 22.5 or newer | sessions, and credentials on OpenCode 2 (they use Node's built-in SQLite) |
|
|
105
|
+
| git | everything |
|
|
106
|
+
| GitHub CLI (`gh`), signed in | only `init`, which creates the repository for you |
|
|
107
|
+
| OpenCode 1.3.4+ or 2.x | the optional plugin |
|
|
55
108
|
|
|
56
109
|
### Set up a machine in one line
|
|
57
110
|
|
|
58
|
-
Pass options to skip
|
|
111
|
+
Pass options to skip every question, for example when preparing a new
|
|
59
112
|
machine:
|
|
60
113
|
|
|
61
114
|
```bash
|
|
62
|
-
curl -fsSL https://raw.githubusercontent.com/
|
|
115
|
+
curl -fsSL https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/install.sh | sh -s -- --mode auto --repo you/my-opencode-config
|
|
63
116
|
```
|
|
64
117
|
|
|
65
118
|
```powershell
|
|
66
|
-
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/
|
|
119
|
+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/install.ps1))) -Mode auto -Repo you/my-opencode-config
|
|
67
120
|
```
|
|
68
121
|
|
|
69
122
|
| Option | Meaning |
|
|
70
123
|
| --- | --- |
|
|
71
|
-
| `--mode cli`
|
|
124
|
+
| `--mode cli` | Install the command only |
|
|
72
125
|
| `--mode link` | Link `--repo` and sync once |
|
|
73
126
|
| `--mode auto` | Link, sync once and turn on autosync |
|
|
74
127
|
| `--repo owner/name` | The repository (a git URL works too); created as private if it does not exist |
|
|
75
128
|
| `--interval N` | Autosync every N minutes (minimum 2, default 5) |
|
|
76
129
|
| `--lang en` / `zh-CN` | Interface language |
|
|
77
130
|
| `--proxy URL` | Proxy for npm and git, during install and for later syncs |
|
|
78
|
-
| `--yes` | Install missing Node.js or git without asking |
|
|
131
|
+
| `--yes` | Install a missing Node.js or git without asking |
|
|
79
132
|
| `--package SPEC` | npm package spec to install (default `opencode-github-sync@latest`) |
|
|
80
133
|
| `--dry-run` | Print what would run, change nothing |
|
|
81
134
|
|
|
82
|
-
On Windows each option is the same word with
|
|
83
|
-
`-Interval`, `-Lang`, `-Proxy`, `-Yes`, `-Package`, `-DryRun`.
|
|
84
|
-
|
|
85
|
-
When the repository already has content and this machine also has its own
|
|
86
|
-
files, setup takes the repository's version and keeps the replaced files in a
|
|
87
|
-
[recovery folder](#safety-features).
|
|
135
|
+
On Windows each option is the same word with one leading dash: `-Mode`,
|
|
136
|
+
`-Repo`, `-Interval`, `-Lang`, `-Proxy`, `-Yes`, `-Package`, `-DryRun`.
|
|
88
137
|
|
|
89
138
|
---
|
|
90
139
|
|
|
91
|
-
##
|
|
140
|
+
## First run
|
|
92
141
|
|
|
93
142
|
<p align="center">
|
|
94
|
-
<img src="https://raw.githubusercontent.com/
|
|
143
|
+
<img src="https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/docs/images/en/03-pick-your-setup.png" alt="Command only, or primary device with autosync" width="760">
|
|
95
144
|
</p>
|
|
96
145
|
|
|
97
|
-
The first time you run `opencode-sync` it asks how this machine should work
|
|
146
|
+
The first time you run `opencode-sync` it asks how this machine should work:
|
|
98
147
|
|
|
99
148
|
| | Command only | Primary device + autosync |
|
|
100
149
|
| --- | --- | --- |
|
|
101
|
-
| How it syncs | You run `opencode-sync push` / `pull`, or the plugin pulls
|
|
150
|
+
| How it syncs | You run `opencode-sync push` / `pull`, or the plugin pulls when OpenCode starts | The operating system syncs every few minutes, even while OpenCode is closed |
|
|
102
151
|
| Good for | A machine you use now and then, a shared or locked-down machine | The machines you work on every day |
|
|
103
152
|
| Background job | None | Task Scheduler, launchd or a systemd timer |
|
|
104
153
|
|
|
105
|
-
|
|
106
|
-
opt-in per machine: turning it on here never turns it on anywhere else.
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## The menu
|
|
111
|
-
|
|
112
|
-
Run `opencode-sync` with no arguments.
|
|
113
|
-
|
|
114
|
-
<p align="center">
|
|
115
|
-
<img src="https://raw.githubusercontent.com/doomsday616/opencode-github-sync/main/docs/menu.svg" alt="The opencode-sync menu" width="760">
|
|
116
|
-
</p>
|
|
154
|
+
Then it links a repository:
|
|
117
155
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
156
|
+
- **No repository yet?** It creates a private one with `gh` (or run
|
|
157
|
+
`opencode-sync init`).
|
|
158
|
+
- **Already have one?** Pick it from the list, or give `owner/name` or any git
|
|
159
|
+
URL (or run `opencode-sync link owner/name`).
|
|
122
160
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
| **What to sync** | Tick main config, instruction files, agents, commands, plugins, skills, credentials, sessions; set session limits; add extra paths |
|
|
127
|
-
| **Autosync** | Turn it on or off, choose 5/10/15/30/60 minutes or your own interval, pause it, run while signed out (Windows), notifications |
|
|
128
|
-
| **Update** | Check npm for a newer version, upgrade, update automatically once a day |
|
|
129
|
-
| **This machine's overrides** | Open the overrides file in your editor, see what it changes |
|
|
130
|
-
| **Diagnostics** | git, node, gh, repository access, the scheduled job, the last log lines; export a support bundle |
|
|
131
|
-
| **Danger zone** | Make this machine match the repository, or the other way round (you type `overwrite` to confirm) |
|
|
132
|
-
| **Uninstall** | Remove the scheduled job, optionally unlink and remove the command. Your configuration is never deleted |
|
|
133
|
-
| **Network proxy** | A proxy for git, gh and npm, used only by opencode-sync |
|
|
134
|
-
| **Restore a file from history** | Pick a file, pick a version, put it back |
|
|
135
|
-
| **Devices** | Every machine that has synced and when, and renaming this one |
|
|
136
|
-
| **Large-change guard** | The limits that make a big push stop and ask |
|
|
137
|
-
| **Language** | English, 简体中文 or automatic |
|
|
161
|
+
If the repository already has content and this machine has its own files, the
|
|
162
|
+
menu shows the differences and lets you pick a side. The losing side's files
|
|
163
|
+
are copied to the [recovery folder](#safety) first.
|
|
138
164
|
|
|
139
|
-
|
|
165
|
+
You can change your mind any time under **Autosync**. Autosync is per machine:
|
|
166
|
+
turning it on here never turns it on anywhere else.
|
|
140
167
|
|
|
141
168
|
---
|
|
142
169
|
|
|
143
170
|
## What gets synced
|
|
144
171
|
|
|
145
172
|
<p align="center">
|
|
146
|
-
<img src="https://raw.githubusercontent.com/
|
|
173
|
+
<img src="https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/docs/images/en/02-how-it-works.png" alt="Each machine pushes and pulls through one private repository" width="760">
|
|
147
174
|
</p>
|
|
148
175
|
|
|
149
176
|
Your `~/.config/opencode` folder becomes a working copy of the repository.
|
|
150
|
-
Everything
|
|
177
|
+
Everything that lives elsewhere is mirrored into a folder inside it.
|
|
151
178
|
|
|
152
179
|
| On your machine | In the repository | What it holds |
|
|
153
180
|
| --- | --- | --- |
|
|
154
|
-
| `~/.config/opencode/` | the root |
|
|
155
|
-
| `~/.local/share/opencode/` | `_data/` | project metadata
|
|
156
|
-
| `~/.local/state/opencode/` | `_state/` | model cache
|
|
181
|
+
| `~/.config/opencode/` | the root | `opencode.json(c)`, `tui.json(c)`, OpenCode 2's `cli.json`, agents, commands, plugins, themes, instruction files |
|
|
182
|
+
| `~/.local/share/opencode/` | `_data/` | project metadata; logins if you [opt in](#credentials) |
|
|
183
|
+
| `~/.local/state/opencode/` | `_state/` | model cache and other interface state |
|
|
157
184
|
| `~/.agents/skills/` | `_agents/` | skills installed with the `skills` CLI |
|
|
158
|
-
| selected sessions | `_sessions/` | one small compressed file per session |
|
|
159
|
-
| your extra paths | `_extra/` |
|
|
185
|
+
| selected sessions | `_sessions/` | one small compressed file per session, if you [opt in](#sessions) |
|
|
186
|
+
| your extra paths | `_extra/` | any other file or folder you add, such as `.config/gh/config.yml` |
|
|
160
187
|
|
|
161
188
|
Each part can be switched off under **What to sync**. A part you switch off
|
|
162
189
|
stays local in both directions: your edits are not sent, and other machines'
|
|
163
190
|
versions do not replace yours.
|
|
164
191
|
|
|
165
|
-
**Never synced
|
|
166
|
-
|
|
167
|
-
and
|
|
192
|
+
**Never synced**
|
|
193
|
+
|
|
194
|
+
- The `opencode.db` database itself, tool output, snapshots and logs. Sessions
|
|
195
|
+
travel as separate small files instead.
|
|
196
|
+
- `node_modules` and other generated folders.
|
|
197
|
+
- opencode-sync's own settings and overrides files.
|
|
198
|
+
- Anything that describes one machine rather than your setup: OpenCode 2's
|
|
199
|
+
`service.json` (one in the config folder and one in the state folder; each
|
|
200
|
+
holds the local background service's password), lock files, prompt history,
|
|
201
|
+
recent-file lists, and `cli.json` plugin entries that point into this
|
|
202
|
+
machine's home folder.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## OpenCode 2
|
|
207
|
+
|
|
208
|
+
opencode-github-sync 3.3.0 and later support OpenCode 2 (`@opencode/cli`) fully.
|
|
209
|
+
Machines on OpenCode 1 and OpenCode 2 can use one repository side by side.
|
|
210
|
+
|
|
211
|
+
What is different on OpenCode 2, and what this tool does about it:
|
|
212
|
+
|
|
213
|
+
| OpenCode 2 changed | What opencode-sync does |
|
|
214
|
+
| --- | --- |
|
|
215
|
+
| Sessions live in new tables, and a fresh OpenCode 2 database has no old ones | Reads and writes OpenCode 2's own tables. OpenCode 1 machines keep their own format; each side imports only its own kind and leaves the other's in place |
|
|
216
|
+
| `/session` lists only the sessions of the current folder's project | Each imported session is placed in the project OpenCode 2 uses for that folder on the receiving machine, so it appears in `/session` |
|
|
217
|
+
| Sessions migrated from 1.x can vanish from `/session` | `opencode-sync repair-sessions` moves them back where `/session` looks |
|
|
218
|
+
| Logins live in the database, and `auth.json` is read at most once | With credential sync on, logins are copied between the two around every sync |
|
|
219
|
+
| Interface preferences moved to `cli.json` | Shared as part of the main config, without this machine's plugin paths |
|
|
220
|
+
| A `service.json` with a password sits in the config folder | Never committed, and removed from repositories an older version wrote it into |
|
|
221
|
+
| Configuration reloads by itself | The "restart OpenCode" hint only appears where a restart is still needed: OpenCode 1, or a changed plugin |
|
|
222
|
+
|
|
223
|
+
To move a machine from OpenCode 1 to 2, see [Upgrading to OpenCode 2](#upgrading-to-opencode-2).
|
|
168
224
|
|
|
169
225
|
---
|
|
170
226
|
|
|
171
|
-
##
|
|
227
|
+
## Autosync
|
|
172
228
|
|
|
173
229
|
<p align="center">
|
|
174
|
-
<img src="https://raw.githubusercontent.com/
|
|
230
|
+
<img src="https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/docs/images/en/04-autosync.png" alt="Each machine syncs on its own schedule, waits while you edit, and backs off on errors" width="760">
|
|
175
231
|
</p>
|
|
176
232
|
|
|
177
233
|
When autosync is on, the operating system starts `opencode-sync autosync run`
|
|
178
|
-
every few minutes and at sign-in (on Windows also when you unlock or
|
|
179
|
-
over Remote Desktop). Each run makes one decision:
|
|
234
|
+
every few minutes and at sign-in (on Windows also when you unlock the screen or
|
|
235
|
+
reconnect over Remote Desktop). Each run makes one decision:
|
|
180
236
|
|
|
181
|
-
1. **Is it quiet?** If
|
|
237
|
+
1. **Is it quiet?** If a file in your config or skills folders changed in the
|
|
182
238
|
last minute, something is still being written. Sending now could publish a
|
|
183
239
|
half-saved file, so the push waits.
|
|
184
|
-
2. **Can it at least receive?** While busy
|
|
185
|
-
changes, but only when this machine has nothing of its own
|
|
186
|
-
Otherwise
|
|
187
|
-
3. **Push and receive.** Your changes go up
|
|
188
|
-
in one step.
|
|
189
|
-
|
|
190
|
-
The rules that keep
|
|
191
|
-
|
|
192
|
-
- **Machines take turns.** Each machine waits a
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
- **It backs off
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
- **It
|
|
200
|
-
off, one when it recovers.
|
|
201
|
-
- **It never runs twice at once.**
|
|
202
|
-
|
|
203
|
-
- **It never
|
|
204
|
-
[large-change guard](#safety
|
|
205
|
-
|
|
240
|
+
2. **Can it at least receive?** While you are busy it still takes other
|
|
241
|
+
machines' changes, but only when this machine has nothing of its own
|
|
242
|
+
waiting. Otherwise everything waits for the next run.
|
|
243
|
+
3. **Push and receive.** Your changes go up and other machines' changes come
|
|
244
|
+
down in one step.
|
|
245
|
+
|
|
246
|
+
The rules that keep it safe:
|
|
247
|
+
|
|
248
|
+
- **Machines take turns.** Each machine waits a few seconds, fixed per machine,
|
|
249
|
+
so two machines on the same schedule do not collide every time. If another
|
|
250
|
+
machine still gets there first, this one takes the new commit and tries
|
|
251
|
+
again; that does not count as an error.
|
|
252
|
+
- **It backs off but never gives up.** After three failures in a row (usually
|
|
253
|
+
no network) it waits 30 minutes, then an hour between attempts. The first
|
|
254
|
+
success puts it back on schedule.
|
|
255
|
+
- **It interrupts you twice at most.** One notification when it starts backing
|
|
256
|
+
off, one when it recovers. Ordinary syncs are silent.
|
|
257
|
+
- **It never runs twice at once.** One lock is shared by the scheduled job, the
|
|
258
|
+
command, the menu and every OpenCode window; whoever finds it busy skips.
|
|
259
|
+
- **It never approves a large change by itself.** Anything that trips the
|
|
260
|
+
[large-change guard](#safety) is held back and you get a notification.
|
|
261
|
+
- **It renews a shared ChatGPT login.** See [Credentials](#credentials).
|
|
206
262
|
|
|
207
263
|
| Platform | Scheduler | Notes |
|
|
208
264
|
| --- | --- | --- |
|
|
209
|
-
| Windows | Task Scheduler | Runs hidden. To run while signed out, turn
|
|
265
|
+
| Windows | Task Scheduler | Runs hidden. To run while signed out, turn it on in the menu and install from an administrator terminal |
|
|
210
266
|
| macOS | launchd agent | `~/Library/LaunchAgents/com.opencode-github-sync.autosync.plist` |
|
|
211
267
|
| Linux | systemd user timer | Falls back to a crontab line. On a server, run `loginctl enable-linger` so it runs while you are logged out |
|
|
212
268
|
|
|
213
|
-
`opencode-sync autosync status` shows the last run, the last error and
|
|
214
|
-
|
|
215
|
-
|
|
269
|
+
`opencode-sync autosync status` shows the last run, the last error and the next
|
|
270
|
+
attempt. With autosync on, the plugin stops pushing on idle so the two never
|
|
271
|
+
compete; it still pulls when OpenCode starts.
|
|
216
272
|
|
|
217
273
|
---
|
|
218
274
|
|
|
@@ -240,16 +296,16 @@ overrides** in the menu:
|
|
|
240
296
|
```
|
|
241
297
|
|
|
242
298
|
Objects merge key by key, lists and plain values replace, and `null` removes a
|
|
243
|
-
key. Before every push,
|
|
299
|
+
key. Before every push, each key the overrides file claims is put back to the
|
|
244
300
|
repository's value, so your machine-only values never reach other machines.
|
|
245
|
-
Without an overrides file
|
|
301
|
+
Without an overrides file the config is copied exactly as written, comments
|
|
246
302
|
and all.
|
|
247
303
|
|
|
248
304
|
---
|
|
249
305
|
|
|
250
306
|
## Sessions
|
|
251
307
|
|
|
252
|
-
Off by default.
|
|
308
|
+
Off by default. Turn it on only for a private repository: conversations are
|
|
253
309
|
private.
|
|
254
310
|
|
|
255
311
|
```bash
|
|
@@ -260,45 +316,111 @@ opencode-sync sessions exclude ses_0ba19b4e7ffeMbSmWYi3Nj6xfZ # never sync this
|
|
|
260
316
|
```
|
|
261
317
|
|
|
262
318
|
Sessions are not synced by committing the database. A real OpenCode database
|
|
263
|
-
grows to several gigabytes, mostly tool output, and git cannot merge it.
|
|
264
|
-
session is exported on its own as a small compressed file
|
|
265
|
-
|
|
266
|
-
- **Small.** Only recent sessions (7 days and 50 sessions by default),
|
|
267
|
-
single session over 5 MB is skipped.
|
|
268
|
-
- **
|
|
269
|
-
touch different files.
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
319
|
+
grows to several gigabytes, mostly tool output, and git cannot merge it.
|
|
320
|
+
Instead each session is exported on its own as a small compressed file:
|
|
321
|
+
|
|
322
|
+
- **Small.** Only recent sessions travel (7 days and 50 sessions by default),
|
|
323
|
+
and any single session over 5 MB is skipped.
|
|
324
|
+
- **Conflicts are rare and resolved.** Two machines working on different
|
|
325
|
+
sessions touch different files. When one session changed on two machines, the
|
|
326
|
+
newer copy wins; on OpenCode 2 the replaced local copy is saved to the
|
|
327
|
+
recovery folder first if it had messages the newer one lacks.
|
|
328
|
+
- **Never disturbs a running conversation.** A session that is busy on this
|
|
329
|
+
machine is not replaced, and runtime state (busy, compacting, retry counters)
|
|
330
|
+
is never carried over, so a receiving machine never resumes a conversation on
|
|
331
|
+
its own.
|
|
332
|
+
- **Lands in the right place.** On OpenCode 2 an imported session is placed in
|
|
333
|
+
the project OpenCode 2 uses for its folder here. A folder under the other
|
|
334
|
+
machine's home is matched to the same folder under yours, and a repository
|
|
335
|
+
checked out at a different path is matched by its project id. A session whose
|
|
336
|
+
folder or repository this machine does not have yet waits in your home
|
|
337
|
+
folder's project and moves into the repository's project on the first pull
|
|
338
|
+
after you open the repository here.
|
|
339
|
+
- **Safe to import.** Each session is imported in one transaction, so a failure
|
|
340
|
+
leaves your database as it was.
|
|
273
341
|
|
|
274
342
|
Window, count and size limits are under **What to sync → Session settings**.
|
|
275
|
-
|
|
343
|
+
Sessions need Node.js 22.5 or newer.
|
|
344
|
+
|
|
345
|
+
**How projects are handled (OpenCode 2).** Projects are not synced as such.
|
|
346
|
+
A project row records where a folder or repository lives on one machine, so
|
|
347
|
+
each machine keeps its own, and OpenCode creates them when it opens a folder.
|
|
348
|
+
What travels is the session, together with its project's id. OpenCode 2 gives
|
|
349
|
+
a repository the same id on every machine (from its remote URL, else
|
|
350
|
+
`.git/opencode`, else its first commit) and a plain folder an id from its
|
|
351
|
+
path, so on import the session is put into the matching project here:
|
|
352
|
+
|
|
353
|
+
| On this machine | The session goes to |
|
|
354
|
+
|---|---|
|
|
355
|
+
| Same folder (or the same folder under your home) | That folder's project |
|
|
356
|
+
| Same repository, at another path | That repository's project, same subfolder if it exists |
|
|
357
|
+
| Neither yet | Your home folder's project; moved into the repository's project on the first pull after you open it here |
|
|
358
|
+
|
|
359
|
+
**Sessions missing from `/session` after upgrading to OpenCode 2?** OpenCode's
|
|
360
|
+
own migration leaves some of them in a project `/session` never shows. Their
|
|
361
|
+
content is intact:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
opencode-sync repair-sessions # preview: what would move where
|
|
365
|
+
opencode-sync repair-sessions --apply # move them
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Credentials
|
|
371
|
+
|
|
372
|
+
Off by default, and refused outright when the repository is public. Turn it on
|
|
373
|
+
under **What to sync → Credentials** or with `"includeCredentials": true`.
|
|
374
|
+
|
|
375
|
+
On OpenCode 1, `auth.json` is synced as a file. On OpenCode 2, which keeps
|
|
376
|
+
logins in its database, opencode-sync also copies between the database and
|
|
377
|
+
`auth.json` around every sync:
|
|
378
|
+
|
|
379
|
+
- The account you pick in OpenCode (for example after `/connect` or switching
|
|
380
|
+
accounts) is what the other machines receive. A running OpenCode picks up an
|
|
381
|
+
incoming account on its next request, without a restart.
|
|
382
|
+
- A renewed login updates the existing account instead of adding a copy. When
|
|
383
|
+
both sides changed, the one that expires later wins.
|
|
384
|
+
- An account missing from an incoming copy never logs this machine out.
|
|
385
|
+
Logging out on a machine removes that account from the shared copy.
|
|
386
|
+
- A broken or half-written `auth.json` is never overwritten.
|
|
387
|
+
- To tell which side changed, only hashes of the last synced values are kept,
|
|
388
|
+
in `opencode-sync-credentials.json` next to the database. Never the secrets.
|
|
389
|
+
|
|
390
|
+
**Shared ChatGPT login.** Renewing an OpenAI login invalidates the previous
|
|
391
|
+
one, so machines that each renew the same login log each other out. With
|
|
392
|
+
credential sync on, only one machine renews it: the scheduled job claims a
|
|
393
|
+
lease in the sync repository (an atomic operation on GitHub's side), renews
|
|
394
|
+
three days before the login expires, and the next sync hands the new login to
|
|
395
|
+
every other machine. A claim older than 15 minutes is considered abandoned and
|
|
396
|
+
can be taken over. Set `"openaiRefreshLease": false` to turn this off.
|
|
276
397
|
|
|
277
398
|
---
|
|
278
399
|
|
|
279
|
-
## Safety
|
|
400
|
+
## Safety
|
|
280
401
|
|
|
281
402
|
<p align="center">
|
|
282
|
-
<img src="https://raw.githubusercontent.com/
|
|
403
|
+
<img src="https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/docs/images/en/05-safety-net.png" alt="One sync at a time, all-or-nothing writes, restore earlier versions, large-change guard" width="760">
|
|
283
404
|
</p>
|
|
284
405
|
|
|
285
|
-
- **
|
|
286
|
-
in, so a crash mid-sync cannot leave a half-written config that stops
|
|
406
|
+
- **All-or-nothing writes.** Files are written beside their target and then
|
|
407
|
+
swapped in, so a crash mid-sync cannot leave a half-written config that stops
|
|
287
408
|
OpenCode from starting.
|
|
288
409
|
- **Push verification.** After pushing, the remote is read back. `git push`
|
|
289
410
|
can report success without the remote changing; that is checked, not
|
|
290
411
|
assumed.
|
|
291
|
-
- **One sync at a time.** A lock shared by the plugin, the
|
|
292
|
-
the scheduled job.
|
|
412
|
+
- **One sync at a time.** A lock shared by the plugin, the command, the menu
|
|
413
|
+
and the scheduled job.
|
|
293
414
|
- **Large-change guard.** A push that adds more than 300 files, more than
|
|
294
415
|
10 MB in total, or any single file over 2 MB stops and asks. The limits are
|
|
295
416
|
adjustable. Generated folders such as `node_modules`, `.venv`, `venv`,
|
|
296
417
|
`__pycache__`, `dist` and `.cache` are never sent.
|
|
297
|
-
- **Recovery folder.** Before a forced pull, a "repository wins" first link,
|
|
298
|
-
|
|
418
|
+
- **Recovery folder.** Before a forced pull, a "repository wins" first link, a
|
|
419
|
+
restore from history, or replacing a session that was continued on both
|
|
420
|
+
machines, what is about to be replaced is copied to
|
|
299
421
|
`~/.local/share/opencode/opencode-sync-recovery/<time>-<reason>/`.
|
|
300
|
-
- **
|
|
301
|
-
|
|
422
|
+
- **Machine secrets stay home.** OpenCode 2's `service.json`, lock files and
|
|
423
|
+
per-machine histories are never committed.
|
|
302
424
|
- **Your hostname stays private.** Commits name the machine by a stable
|
|
303
425
|
pseudonym (or a name you choose), never by its real hostname.
|
|
304
426
|
- **Symlinks are refused, not followed**, so a sync cannot copy files from
|
|
@@ -306,6 +428,37 @@ Session sync needs Node.js 22.5 or newer.
|
|
|
306
428
|
|
|
307
429
|
---
|
|
308
430
|
|
|
431
|
+
## The menu
|
|
432
|
+
|
|
433
|
+
Run `opencode-sync` with no arguments.
|
|
434
|
+
|
|
435
|
+
<p align="center">
|
|
436
|
+
<img src="https://raw.githubusercontent.com/lazyalex616/opencode-github-sync/main/docs/menu.svg" alt="The opencode-sync menu" width="760">
|
|
437
|
+
</p>
|
|
438
|
+
|
|
439
|
+
Arrow keys or the shown hotkey pick an item, space ticks a checkbox, Enter
|
|
440
|
+
confirms and Esc goes back. When the input is not a terminal (a pipe, a script,
|
|
441
|
+
CI) every prompt becomes a numbered question, so the menu can be driven from a
|
|
442
|
+
file.
|
|
443
|
+
|
|
444
|
+
| Item | What you can do there |
|
|
445
|
+
| --- | --- |
|
|
446
|
+
| **Sync now** | Push and receive, receive only, push only, or preview first |
|
|
447
|
+
| **What to sync** | Tick main config, instruction files, agents, commands, plugins, skills, credentials, sessions; set session limits; add extra paths |
|
|
448
|
+
| **Autosync** | On or off; every 5/10/15/30/60 minutes or your own interval; pause; run while signed out (Windows); notifications |
|
|
449
|
+
| **Update** | Check npm for a newer version, upgrade, or update automatically once a day |
|
|
450
|
+
| **This machine's overrides** | Open the overrides file in your editor and see what it changes |
|
|
451
|
+
| **Diagnostics** | git, node, gh, repository access, the scheduled job, the last log lines; export a support bundle |
|
|
452
|
+
| **Danger zone** | Make this machine match the repository, or the other way round (type `overwrite` to confirm) |
|
|
453
|
+
| **Uninstall** | Remove the scheduled job, optionally unlink and remove the command. Your configuration is never deleted |
|
|
454
|
+
| **Network proxy** | A proxy for git, gh and npm, used only by opencode-sync |
|
|
455
|
+
| **Restore a file from history** | Pick a file, pick a version, put it back |
|
|
456
|
+
| **Devices** | Every machine that has synced and when; rename this one |
|
|
457
|
+
| **Large-change guard** | The limits that make a big push stop and ask |
|
|
458
|
+
| **Language** | English, 简体中文 or automatic |
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
309
462
|
## OpenCode plugin
|
|
310
463
|
|
|
311
464
|
The plugin is optional. It pulls when OpenCode starts, can push when a session
|
|
@@ -320,22 +473,19 @@ language.
|
|
|
320
473
|
}
|
|
321
474
|
```
|
|
322
475
|
|
|
323
|
-
|
|
324
|
-
OpenCode 2
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
OpenCode 1.0–1.3.3 cannot load 3.1.0 and later; stay on
|
|
330
|
-
`opencode-github-sync@3.0.1` there.
|
|
476
|
+
The `"plugin"` key works on OpenCode 1.x (1.3.4 and later) and 2.x. If you run
|
|
477
|
+
only OpenCode 2 you can use its native `"plugins"` key instead, but do not list
|
|
478
|
+
the plugin under both: OpenCode 2 loads entries from both lists. OpenCode
|
|
479
|
+
1.0–1.3.3 cannot load 3.1.0 and later; stay on `opencode-github-sync@3.0.1`
|
|
480
|
+
there.
|
|
331
481
|
|
|
332
482
|
Keep the command installed even if you use the plugin. A plugin cannot repair
|
|
333
|
-
|
|
483
|
+
a configuration that stops OpenCode from loading it; `opencode-sync pull
|
|
334
484
|
--force` can.
|
|
335
485
|
|
|
336
486
|
---
|
|
337
487
|
|
|
338
|
-
##
|
|
488
|
+
## Commands
|
|
339
489
|
|
|
340
490
|
| Command | What it does |
|
|
341
491
|
| --- | --- |
|
|
@@ -354,6 +504,7 @@ the configuration that stops OpenCode from loading it; `opencode-sync pull
|
|
|
354
504
|
| `opencode-sync autosync reset` | Clear the failure counter |
|
|
355
505
|
| `opencode-sync sessions list\|enable\|disable` | Session sync |
|
|
356
506
|
| `opencode-sync sessions include\|exclude <id>` | Always or never sync one session |
|
|
507
|
+
| `opencode-sync repair-sessions [--apply]` | OpenCode 2: move sessions missing from `/session` into their project (preview without `--apply`) |
|
|
357
508
|
| `opencode-sync overrides` | Create or locate the overrides file |
|
|
358
509
|
| `opencode-sync config` | Print the settings |
|
|
359
510
|
|
|
@@ -373,7 +524,9 @@ the configuration that stops OpenCode from loading it; `opencode-sync pull
|
|
|
373
524
|
| `SYNC_REMOTE_URL` | Override the repository URL |
|
|
374
525
|
| `NO_COLOR` | Plain output |
|
|
375
526
|
|
|
376
|
-
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## Settings file
|
|
377
530
|
|
|
378
531
|
`~/.config/opencode/opencode-sync.jsonc` stays on this machine and is never
|
|
379
532
|
committed. The menu edits it for you; every key is optional.
|
|
@@ -383,6 +536,7 @@ committed. The menu edits it for you; every key is optional.
|
|
|
383
536
|
"repo": { "owner": "you", "name": "my-opencode-config", "branch": "main" },
|
|
384
537
|
"machineAlias": "laptop",
|
|
385
538
|
"includeCredentials": false,
|
|
539
|
+
"openaiRefreshLease": true,
|
|
386
540
|
"includeSkills": true,
|
|
387
541
|
"includeState": true,
|
|
388
542
|
"extraPaths": [".config/gh/config.yml"],
|
|
@@ -398,23 +552,36 @@ committed. The menu edits it for you; every key is optional.
|
|
|
398
552
|
}
|
|
399
553
|
```
|
|
400
554
|
|
|
555
|
+
| Key | Meaning |
|
|
556
|
+
| --- | --- |
|
|
557
|
+
| `machineAlias` | Name for this machine in commits; unset means a stable pseudonym |
|
|
558
|
+
| `includeCredentials` | Sync logins ([Credentials](#credentials)); private repositories only |
|
|
559
|
+
| `openaiRefreshLease` | With credentials on, let one machine at a time renew a shared ChatGPT login |
|
|
560
|
+
| `includeSkills` / `includeState` | Sync `~/.agents/skills` / `~/.local/state/opencode` |
|
|
561
|
+
| `extraPaths` | Extra files or folders, relative to your home folder |
|
|
562
|
+
| `categories` | Which parts of the config folder are shared |
|
|
563
|
+
| `sessions` | [Session](#sessions) window, count and size limits |
|
|
564
|
+
| `autosync` | [Autosync](#autosync) interval, quiet period, run while signed out, daily self-update |
|
|
565
|
+
| `guard` | [Large-change guard](#safety) limits |
|
|
566
|
+
| `autoPullOnStartup` / `autoPushOnIdle` | What the [plugin](#opencode-plugin) does |
|
|
567
|
+
|
|
401
568
|
---
|
|
402
569
|
|
|
403
570
|
## Troubleshooting
|
|
404
571
|
|
|
405
572
|
**I am behind a proxy.** Pass `--proxy http://host:port` (or `-Proxy` on
|
|
406
573
|
Windows) to the installer. It is used for npm and git during the install and
|
|
407
|
-
saved for later syncs
|
|
574
|
+
saved for later syncs, including the ChatGPT login renewal. Change it any time
|
|
575
|
+
under **Network proxy**.
|
|
408
576
|
|
|
409
577
|
**`curl | sh` does not ask me anything.** The script itself arrives through the
|
|
410
|
-
pipe, so it reads your answers from the terminal instead.
|
|
411
|
-
terminal (CI, a Dockerfile)
|
|
412
|
-
|
|
578
|
+
pipe, so it reads your answers from the terminal instead. Where there is no
|
|
579
|
+
terminal (CI, a Dockerfile) nobody can answer: pass `--mode` and `--repo`, plus
|
|
580
|
+
`--yes` if Node.js or git may need installing.
|
|
413
581
|
|
|
414
582
|
**Windows says running scripts is disabled.** `irm ... | iex` does not run a
|
|
415
|
-
script file, so the execution policy does not apply
|
|
416
|
-
`install.ps1`
|
|
417
|
-
`powershell -ExecutionPolicy Bypass -File install.ps1`.
|
|
583
|
+
script file, so the execution policy does not apply. To run a downloaded
|
|
584
|
+
`install.ps1` as a file, use `powershell -ExecutionPolicy Bypass -File install.ps1`.
|
|
418
585
|
|
|
419
586
|
**`opencode-sync` is not found after installing.** npm installed it into a
|
|
420
587
|
folder that is not on your `PATH`. `npm prefix -g` shows the folder; add its
|
|
@@ -425,6 +592,21 @@ shows whether it is paused, backing off after errors, or waiting because files
|
|
|
425
592
|
are still changing. **Diagnostics** in the menu shows whether the scheduled job
|
|
426
593
|
is registered.
|
|
427
594
|
|
|
595
|
+
**A synced session does not show up in `/session` (OpenCode 2).** Open
|
|
596
|
+
OpenCode in the session's folder or repository; `/session` lists only that
|
|
597
|
+
project. A session whose repository you have not opened on this machine yet is
|
|
598
|
+
in your home folder's project until the next pull after you open it.
|
|
599
|
+
Sessions from before your upgrade to OpenCode 2: run
|
|
600
|
+
`opencode-sync repair-sessions --apply`.
|
|
601
|
+
|
|
602
|
+
**Sessions are not synced at all.** Check `opencode-sync status` shows session
|
|
603
|
+
sync as on, and that `node --version` is 22.5 or newer.
|
|
604
|
+
|
|
605
|
+
**A login did not arrive on another machine (OpenCode 2).** Credentials must be
|
|
606
|
+
on for both machines. Run a sync on the machine where you logged in, then on
|
|
607
|
+
the other one. If two accounts of one provider are both marked active, nothing
|
|
608
|
+
is changed for that provider; switch accounts once in OpenCode to settle it.
|
|
609
|
+
|
|
428
610
|
**A pull conflicted with my local edits.** Your edits are kept in a git stash
|
|
429
611
|
and the exact commands to get them back are printed. Nothing is lost.
|
|
430
612
|
|
|
@@ -445,17 +627,53 @@ The files it replaces go to the recovery folder first.
|
|
|
445
627
|
|
|
446
628
|
---
|
|
447
629
|
|
|
448
|
-
## Upgrading
|
|
630
|
+
## Upgrading
|
|
631
|
+
|
|
632
|
+
### Upgrading to OpenCode 2
|
|
633
|
+
|
|
634
|
+
Upgrade opencode-github-sync to 3.3.0 or later on every machine first. 3.2.x
|
|
635
|
+
cannot read OpenCode 2 sessions, and it commits OpenCode 2's `service.json`.
|
|
636
|
+
|
|
637
|
+
1. Install OpenCode 2. With npm 12 its install scripts must be allowed, or the
|
|
638
|
+
`opencode` command is only a placeholder:
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
npm install -g @opencode/cli --allow-scripts=@opencode/cli
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
2. Optionally stop OpenCode 2 from updating itself in the background; an
|
|
645
|
+
unattended self-update through npm 12 can break the install:
|
|
646
|
+
|
|
647
|
+
```bash
|
|
648
|
+
opencode service set env OPENCODE_DISABLE_AUTOUPDATE 1
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
3. Start OpenCode 2 once so it migrates your 1.x data, then bring back the
|
|
652
|
+
sessions `/session` no longer shows:
|
|
653
|
+
|
|
654
|
+
```bash
|
|
655
|
+
opencode-sync repair-sessions # preview
|
|
656
|
+
opencode-sync repair-sessions --apply
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
**If you synced with 3.2.x on OpenCode 2**, your repository may contain
|
|
660
|
+
`service.json` and `_state/service.json`. 3.3.0 removes them on its next push,
|
|
661
|
+
but they stay in the repository's history. The password in them only opens the
|
|
662
|
+
local background service of that machine. To remove them from history as well,
|
|
663
|
+
delete the repository and push again from one machine.
|
|
664
|
+
|
|
665
|
+
### Upgrading from 3.1.x or 3.2.x
|
|
449
666
|
|
|
450
667
|
```bash
|
|
451
668
|
npm install -g opencode-github-sync@latest
|
|
452
669
|
```
|
|
453
670
|
|
|
454
|
-
Nothing else is required:
|
|
455
|
-
|
|
456
|
-
script of your own
|
|
457
|
-
|
|
458
|
-
|
|
671
|
+
Nothing else is required: settings, overrides and the repository keep working,
|
|
672
|
+
and autosync stays off until you turn it on. If you sync on a timer with a
|
|
673
|
+
script of your own, remove it before turning autosync on so the two do not
|
|
674
|
+
compete. If you used `autoPushOnIdle` in the plugin, autosync replaces it on
|
|
675
|
+
machines where you turn it on. The [changelog](./CHANGELOG.md) lists every
|
|
676
|
+
change.
|
|
459
677
|
|
|
460
678
|
---
|
|
461
679
|
|
|
@@ -469,18 +687,19 @@ npm run build
|
|
|
469
687
|
|
|
470
688
|
The tests run against real git repositories on disk and simulate several
|
|
471
689
|
machines, so pushing, pulling, rebasing, autosync scheduling and the menu are
|
|
472
|
-
exercised end to end.
|
|
473
|
-
|
|
690
|
+
exercised end to end. Session and credential tests use the schema of a real
|
|
691
|
+
OpenCode 2.2.5 database and fake tokens only. Real scheduled jobs are only ever
|
|
692
|
+
registered on disposable CI runners.
|
|
474
693
|
|
|
475
694
|
---
|
|
476
695
|
|
|
477
696
|
## Star history
|
|
478
697
|
|
|
479
|
-
<a href="https://star-history.com/#
|
|
698
|
+
<a href="https://star-history.com/#lazyalex616/opencode-github-sync&Date">
|
|
480
699
|
<picture>
|
|
481
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=
|
|
482
|
-
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=
|
|
483
|
-
<img alt="Star history chart" src="https://api.star-history.com/svg?repos=
|
|
700
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=lazyalex616/opencode-github-sync&type=Date&theme=dark">
|
|
701
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=lazyalex616/opencode-github-sync&type=Date">
|
|
702
|
+
<img alt="Star history chart" src="https://api.star-history.com/svg?repos=lazyalex616/opencode-github-sync&type=Date" width="640">
|
|
484
703
|
</picture>
|
|
485
704
|
</a>
|
|
486
705
|
|
|
@@ -488,7 +707,7 @@ disposable CI runners.
|
|
|
488
707
|
|
|
489
708
|
## License
|
|
490
709
|
|
|
491
|
-
[MIT](https://github.com/
|
|
710
|
+
[MIT](https://github.com/lazyalex616/opencode-github-sync/blob/main/LICENSE)
|
|
492
711
|
|
|
493
712
|
<p align="center">
|
|
494
713
|
<sub>If this saved you some time, a ⭐ is appreciated.</sub>
|