Repository navigation
English
Added
- One-line installers.
install.ps1(Windows PowerShell 5.1 and PowerShell 7) andinstall.sh(macOS, Linux) check for Node.js 18+ and git, offer to install a missing one through winget, Homebrew or the system package manager (they ask first and never install silently), runnpm install -g opencode-github-sync@latest, and open the menu.--mode,--repo,--interval,--lang,--proxyand--yesrun the whole setup non-interactively. Undercurl | shquestions are read from the terminal, and on Windows the menu runs as its own process so it gets the keyboard. - Interactive menu.
opencode-syncwith no arguments (oropencode-sync menu) opens a menu with arrow keys, hotkeys and checkboxes, and falls back to numbered prompts whenever input is not a terminal. Every existing subcommand still works and stays scriptable. First run offers: install the command only, link a repository, or link and make this the primary device with autosync. When the machine and the repository differ, it shows the differences and lets you pick a side; the losing side's files go to a recovery folder. - English and Simplified Chinese for every menu and command string, detected from
OPENCODE_SYNC_LANG,LC_ALL/LC_MESSAGES/LANGor the system locale, and switchable with--langor from the menu. - Autosync driven by the operating system.
opencode-sync autosync install|uninstall|enable|disable|status|run|reset|pause|resume. Task Scheduler on Windows (logon, unlock, remote connect and a repeating timer; hidden throughconhost --headlessor a UTF-16 VBScript launcher), launchd on macOS, a systemd user timer on Linux with a crontab fallback. Each run pushes only when the synced trees have been quiet for a settle period, and otherwise receives only when this machine has nothing of its own in flight. Machines are staggered so they do not collide, failures back off from 30 to 60 minutes without ever giving up, a lost push race is retried rather than counted, and a desktop notification appears only when backing off starts and when it recovers. - What to sync as checkboxes: main config, instruction files, agents, commands, plugins, skills, credentials and sessions. A switched-off category stays local in both directions.
- Large-change guard. A push that adds more than 300 files, more than 10 MB, or any file over 2 MB waits for confirmation (thresholds are adjustable). Autosync never confirms: it records a failure and notifies. The first push into an empty repository carries the whole existing setup, so only the single-file limit applies there. Generated directories (
node_modules,.venv,venv,__pycache__,dist,.cache) are never staged. - Restore a file from history, with the replaced version kept in the recovery folder.
- Device list built from commit history, and renaming this machine.
- Network proxy for git, gh and npm, applied to child processes only.
- Preview of what a sync would change before running it.
- Support bundle export with tokens, passwords and URL credentials removed.
- Update menu: check npm, upgrade, and an optional daily auto-update run by the autosync job.
Changed
- When autosync is on, the plugin no longer pushes on idle (it still pulls at startup), so it never races the scheduled job.
- Sync commits carry an
Opencode-Sync-Devicetrailer naming the machine. linkaccepts any git URL or local path in addition toowner/name.- A forced pull, and the first pull onto a machine that already has files, copy the files they replace into
opencode-sync-recoveryunder the data directory first. This covers new folders, non-ASCII file names, and local skills and extra-path files that the forced pull removes or overwrites.
Fixed
- A push that loses a race with another machine rebases and retries up to three times instead of failing. A protected branch or a declined hook is reported as a failure rather than retried.
- The first push from a machine whose config directory is not yet a repository now writes the remote's skills out before staging, so it can no longer publish every skill it lacks as a deletion.
- Git runs with
core.quotepath=offand English messages, so non-ASCII file names count toward the large-change guard and a lost push race is recognised on a localized git.
简体中文
新增
- 一行命令安装。
install.ps1(Windows PowerShell 5.1 和 PowerShell 7 都能用)和install.sh(macOS、Linux)会检查 Node.js 18+ 和 git,缺了就提示用 winget、Homebrew 或系统包管理器安装(一定先问,绝不偷偷装),然后执行npm install -g opencode-github-sync@latest并打开菜单。带上--mode、--repo、--interval、--lang、--proxy、--yes可以全程无人值守完成设置。用curl | sh时问题从终端读取;在 Windows 上菜单作为独立进程启动,键盘输入不会被管道吃掉。 - 交互菜单。 直接运行
opencode-sync(或opencode-sync menu)会打开菜单,支持方向键、快捷键和勾选框;输入不是终端时自动改用编号提问。原有子命令全部保留,照样可以写进脚本。第一次运行时可以选:只装命令、关联仓库、关联并把本机设为开启自动同步的主力设备。本机和仓库内容不一样时会先列出差异让你选以哪边为准,被替换的一方会先存进恢复目录。 - 英文和简体中文界面,覆盖所有菜单和命令输出。语言按
OPENCODE_SYNC_LANG、LC_ALL/LC_MESSAGES/LANG、系统区域设置依次判断,也可以用--lang或在菜单里切换。 - 由操作系统驱动的自动同步。 新增
opencode-sync autosync install|uninstall|enable|disable|status|run|reset|pause|resume。Windows 用任务计划程序(登录、解锁、远程连接时触发,外加定时重复;通过conhost --headless或 UTF-16 编码的 VBScript 隐藏窗口),macOS 用 launchd,Linux 用 systemd 用户定时器,不可用时退回 crontab。每次运行只在同步目录安静一段时间后才推送;还有文件在变化时,只有本机没有待处理的改动才会接收。多台机器会错开时间避免撞车;连续失败后退避间隔从 30 分钟加到 60 分钟,但永不放弃;推送被别的机器抢先不算失败,会自动重试;桌面通知只在开始退避和恢复正常时各弹一次。 - 同步内容勾选:主配置、指令文件、智能体、自定义命令、插件、技能、登录凭据、会话。关掉的类别双向都只留在本机。
- 大改动保护。 一次推送新增超过 300 个文件、总量超过 10 MB,或有单个文件超过 2 MB 时,要先确认(阈值可调)。自动同步从不自动确认,只记一次失败并发通知。往空仓库的第一次推送本来就要带上全部现有配置,所以只检查单个文件大小。
node_modules、.venv、venv、__pycache__、dist、.cache这类生成目录永远不会提交。 - 从历史版本恢复单个文件,被替换的版本保存在恢复目录里。
- 设备列表,根据提交历史显示每台机器上次同步的时间,并可以给本机改名。
- 网络代理,只作用于 opencode-sync 启动的 git、gh 和 npm。
- 同步前预览会改动哪些文件。
- 导出排障包,自动去掉令牌、密码和 URL 里的账号密码。
- 更新菜单:检查 npm 新版本、立即升级,以及可选的每日自动更新(由自动同步任务执行)。
变更
- 开启自动同步后,插件不再在会话空闲时推送(启动时仍然拉取),避免和定时任务抢着同步。
- 同步提交带上
Opencode-Sync-Device尾注,记录是哪台机器提交的。 link除了用户名/仓库名,也接受任意 git 地址或本地路径。- 强制拉取,以及本机已有文件时的第一次拉取,会先把将被替换的文件复制到数据目录下的
opencode-sync-recovery。新建的整个文件夹、中文等非 ASCII 文件名,以及强制拉取会删除或覆盖的本机技能和额外路径文件,也都包括在内。
修复
- 推送时被别的机器抢先,会自动变基并最多重试三次,而不是直接失败。分支受保护或被钩子拒绝时会如实报错,不会反复重试。
- 配置目录还不是仓库的机器第一次推送时,会先把仓库里的技能写回本机再打包,不会再把本机缺少的技能当成删除推送出去。
- git 改为以
core.quotepath=off和英文提示运行:中文文件名会正确计入大改动保护,非英文系统上也能识别推送被抢先的情况。
Install
npm install -g opencode-github-sync@3.2.0Plugin users: OpenCode picks up the new version on its next start.
Contributors
Thank you to everyone who made this release possible:
- @vitaly74 — OpenCode 2 plugin entrypoint (#6, 3.1.0)
- @aquelejota — deterministic shard export and working session tests (#5), analysis of #2, #3 and #4 (3.1.0)
- @logser13 — reported #2, #3 and #4 with reproductions and tested fixes (3.1.x)
What's Changed
- 3.2.0: installers, bilingual menu, OS-scheduled autosync by @doomsday616 in #7
Full Changelog: v3.1.1...v3.2.0