opencode-synced 0.7.0 → 0.7.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 +11 -11
- package/dist/command/sync-link.md +2 -2
- package/dist/command/sync-pull.md +2 -2
- package/dist/command/sync-push.md +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/sync/commit.js +2 -2
- package/dist/sync/mcp-secrets.js +1 -1
- package/dist/sync/paths.js +1 -1
- package/dist/sync/service.js +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# opencode-synced
|
|
2
2
|
|
|
3
|
-
Sync global
|
|
3
|
+
Sync global opencode configuration across machines via a GitHub repo, with optional secrets support for private repos.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- Syncs global
|
|
7
|
+
- Syncs global opencode config (`~/.config/opencode`) and related directories
|
|
8
8
|
- Optional secrets sync when the repo is private
|
|
9
9
|
- Optional session sync to share conversation history across machines
|
|
10
10
|
- Optional prompt stash sync to share stashed prompts and history across machines
|
|
@@ -19,7 +19,7 @@ Sync global OpenCode configuration across machines via a GitHub repo, with optio
|
|
|
19
19
|
|
|
20
20
|
## Setup
|
|
21
21
|
|
|
22
|
-
Enable the plugin in your global
|
|
22
|
+
Enable the plugin in your global opencode config (opencode will install it on next run):
|
|
23
23
|
|
|
24
24
|
```jsonc
|
|
25
25
|
{
|
|
@@ -28,7 +28,7 @@ Enable the plugin in your global OpenCode config (OpenCode will install it on ne
|
|
|
28
28
|
}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
opencode does not auto-update plugins. To update, modify the version number in your config file.
|
|
32
32
|
|
|
33
33
|
## Configure
|
|
34
34
|
|
|
@@ -50,7 +50,7 @@ Run `/sync-link` to connect to your existing sync repo:
|
|
|
50
50
|
|
|
51
51
|
If auto-detection fails, specify the repo name: `/sync-link my-opencode-config`
|
|
52
52
|
|
|
53
|
-
After linking, restart
|
|
53
|
+
After linking, restart opencode to apply the synced settings.
|
|
54
54
|
|
|
55
55
|
### Custom repo name or org
|
|
56
56
|
|
|
@@ -101,7 +101,7 @@ in a private repo, set `"includeMcpSecrets": true` (requires `includeSecrets`).
|
|
|
101
101
|
|
|
102
102
|
### Sessions (private repos only)
|
|
103
103
|
|
|
104
|
-
Sync your
|
|
104
|
+
Sync your opencode sessions (conversation history from `/sessions`) across machines by setting `"includeSessions": true`. This requires `includeSecrets` to also be enabled since sessions may contain sensitive data.
|
|
105
105
|
|
|
106
106
|
```jsonc
|
|
107
107
|
{
|
|
@@ -158,8 +158,8 @@ If you want MCP secrets committed (private repos only), set `"includeMcpSecrets"
|
|
|
158
158
|
Env var naming rules:
|
|
159
159
|
|
|
160
160
|
- If the header name already looks like an env var (e.g. `CONTEXT7_API_KEY`), it is used directly.
|
|
161
|
-
- Otherwise: `
|
|
162
|
-
- OAuth client secrets use `
|
|
161
|
+
- Otherwise: `opencode_mcp_<SERVER>_<HEADER>` (non-alphanumerics become `_`).
|
|
162
|
+
- OAuth client secrets use `opencode_mcp_<SERVER>_OAUTH_CLIENT_SECRET`.
|
|
163
163
|
|
|
164
164
|
## Usage
|
|
165
165
|
|
|
@@ -178,7 +178,7 @@ Env var naming rules:
|
|
|
178
178
|
|
|
179
179
|
### Trigger a sync
|
|
180
180
|
|
|
181
|
-
Restart
|
|
181
|
+
Restart opencode to run the startup sync flow (pull remote, apply if changed, push local changes if needed).
|
|
182
182
|
|
|
183
183
|
### Check status
|
|
184
184
|
|
|
@@ -265,7 +265,7 @@ bun -e '
|
|
|
265
265
|
### Local testing (production-like)
|
|
266
266
|
|
|
267
267
|
To test the same artifact that would be published, install from a packed tarball
|
|
268
|
-
into
|
|
268
|
+
into opencode's cache:
|
|
269
269
|
|
|
270
270
|
```bash
|
|
271
271
|
mise run local-pack-test
|
|
@@ -279,7 +279,7 @@ Then set `~/.config/opencode/opencode.json` to use:
|
|
|
279
279
|
}
|
|
280
280
|
```
|
|
281
281
|
|
|
282
|
-
Restart
|
|
282
|
+
Restart opencode to pick up the cached install.
|
|
283
283
|
|
|
284
284
|
|
|
285
285
|
## Prefer a CLI version?
|
|
@@ -5,11 +5,11 @@ description: Link this computer to an existing sync repo
|
|
|
5
5
|
Use the opencode_sync tool with command "link".
|
|
6
6
|
This command is for linking a second (or additional) computer to an existing sync repo that was created on another machine.
|
|
7
7
|
|
|
8
|
-
IMPORTANT: This will OVERWRITE the local
|
|
8
|
+
IMPORTANT: This will OVERWRITE the local opencode configuration with the contents from the synced repo. The only thing preserved is the local overrides file (opencode-synced.overrides.jsonc).
|
|
9
9
|
|
|
10
10
|
If the user provides a repo name argument, pass it as name="repo-name".
|
|
11
11
|
If no repo name is provided, the tool will automatically search for common sync repo names.
|
|
12
12
|
|
|
13
13
|
After linking:
|
|
14
|
-
- Remind the user to restart
|
|
14
|
+
- Remind the user to restart opencode to apply the synced config
|
|
15
15
|
- If they want to enable secrets sync, they should run /sync-enable-secrets
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Pull and apply synced
|
|
2
|
+
description: Pull and apply synced opencode config
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
Use the opencode_sync tool with command "pull".
|
|
6
|
-
If updates are applied, remind the user to restart
|
|
6
|
+
If updates are applied, remind the user to restart opencode.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Plugin } from '@opencode-ai/plugin';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export default
|
|
2
|
+
export declare const opencodeConfigSync: Plugin;
|
|
3
|
+
export declare const opencodeSynced: Plugin;
|
|
4
|
+
export default opencodeConfigSync;
|
package/dist/index.js
CHANGED
|
@@ -85,11 +85,11 @@ async function loadCommands() {
|
|
|
85
85
|
}
|
|
86
86
|
return commands;
|
|
87
87
|
}
|
|
88
|
-
export const
|
|
88
|
+
export const opencodeConfigSync = async (ctx) => {
|
|
89
89
|
const commands = await loadCommands();
|
|
90
90
|
const service = createSyncService(ctx);
|
|
91
91
|
const syncTool = tool({
|
|
92
|
-
description: 'Manage
|
|
92
|
+
description: 'Manage opencode config sync with a GitHub repo',
|
|
93
93
|
args: {
|
|
94
94
|
command: tool.schema
|
|
95
95
|
.enum(['status', 'init', 'link', 'pull', 'push', 'enable-secrets', 'resolve'])
|
|
@@ -200,8 +200,8 @@ export const OpencodeConfigSync = async (ctx) => {
|
|
|
200
200
|
},
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
|
-
export const
|
|
204
|
-
export default
|
|
203
|
+
export const opencodeSynced = opencodeConfigSync;
|
|
204
|
+
export default opencodeConfigSync;
|
|
205
205
|
function formatError(error) {
|
|
206
206
|
if (error instanceof Error)
|
|
207
207
|
return error.message;
|
package/dist/sync/commit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractTextFromResponse, resolveSmallModel, unwrapData } from './utils.js';
|
|
2
2
|
export async function generateCommitMessage(ctx, repoDir, fallbackDate = new Date()) {
|
|
3
|
-
const fallback = `Sync
|
|
3
|
+
const fallback = `Sync opencode config (${formatDate(fallbackDate)})`;
|
|
4
4
|
const diffSummary = await getDiffSummary(ctx.$, repoDir);
|
|
5
5
|
if (!diffSummary)
|
|
6
6
|
return fallback;
|
|
@@ -9,7 +9,7 @@ export async function generateCommitMessage(ctx, repoDir, fallbackDate = new Dat
|
|
|
9
9
|
return fallback;
|
|
10
10
|
const prompt = [
|
|
11
11
|
'Generate a concise single-line git commit message (max 72 chars).',
|
|
12
|
-
'Focus on
|
|
12
|
+
'Focus on opencode config sync changes.',
|
|
13
13
|
'Return only the message, no quotes.',
|
|
14
14
|
'',
|
|
15
15
|
'Diff summary:',
|
package/dist/sync/mcp-secrets.js
CHANGED
|
@@ -46,7 +46,7 @@ function buildHeaderEnvVar(serverName, headerName) {
|
|
|
46
46
|
function buildEnvVar(serverName, key) {
|
|
47
47
|
const serverToken = toEnvToken(serverName, 'SERVER');
|
|
48
48
|
const keyToken = toEnvToken(key, 'VALUE');
|
|
49
|
-
return `
|
|
49
|
+
return `opencode_mcp_${serverToken}_${keyToken}`;
|
|
50
50
|
}
|
|
51
51
|
function toEnvToken(input, fallback) {
|
|
52
52
|
const cleaned = String(input)
|
package/dist/sync/paths.js
CHANGED
|
@@ -39,7 +39,7 @@ export function resolveXdgPaths(env = process.env, platform = process.platform)
|
|
|
39
39
|
}
|
|
40
40
|
export function resolveSyncLocations(env = process.env, platform = process.platform) {
|
|
41
41
|
const xdg = resolveXdgPaths(env, platform);
|
|
42
|
-
const customConfigDir = env.
|
|
42
|
+
const customConfigDir = env.opencode_config_dir;
|
|
43
43
|
const configRoot = customConfigDir
|
|
44
44
|
? path.resolve(expandHome(customConfigDir, xdg.homeDir))
|
|
45
45
|
: path.join(xdg.configDir, 'opencode');
|
package/dist/sync/service.js
CHANGED
|
@@ -187,16 +187,16 @@ export function createSyncService(ctx) {
|
|
|
187
187
|
const lines = [
|
|
188
188
|
`Linked to existing sync repo: ${found.owner}/${found.name}`,
|
|
189
189
|
'',
|
|
190
|
-
'Your local
|
|
190
|
+
'Your local opencode config has been OVERWRITTEN with the synced config.',
|
|
191
191
|
'Your local overrides file was preserved and applied on top.',
|
|
192
192
|
'',
|
|
193
|
-
'Restart
|
|
193
|
+
'Restart opencode to apply the new settings.',
|
|
194
194
|
'',
|
|
195
195
|
found.isPrivate
|
|
196
196
|
? 'To enable secrets sync, run: /sync-enable-secrets'
|
|
197
197
|
: 'Note: Repo is public. Secrets sync is disabled.',
|
|
198
198
|
];
|
|
199
|
-
await showToast(ctx.client, 'Config synced. Restart
|
|
199
|
+
await showToast(ctx.client, 'Config synced. Restart opencode to apply.', 'info');
|
|
200
200
|
return lines.join('\n');
|
|
201
201
|
}),
|
|
202
202
|
pull: () => runExclusive(async () => {
|
|
@@ -220,8 +220,8 @@ export function createSyncService(ctx) {
|
|
|
220
220
|
lastPull: new Date().toISOString(),
|
|
221
221
|
lastRemoteUpdate: new Date().toISOString(),
|
|
222
222
|
});
|
|
223
|
-
await showToast(ctx.client, 'Config updated. Restart
|
|
224
|
-
return 'Remote config applied. Restart
|
|
223
|
+
await showToast(ctx.client, 'Config updated. Restart opencode to apply.', 'info');
|
|
224
|
+
return 'Remote config applied. Restart opencode to use new settings.';
|
|
225
225
|
}),
|
|
226
226
|
push: () => runExclusive(async () => {
|
|
227
227
|
const config = await getConfigOrThrow(locations);
|
|
@@ -316,7 +316,7 @@ async function runStartup(ctx, locations, config, log) {
|
|
|
316
316
|
lastPull: new Date().toISOString(),
|
|
317
317
|
lastRemoteUpdate: new Date().toISOString(),
|
|
318
318
|
});
|
|
319
|
-
await showToast(ctx.client, 'Config updated. Restart
|
|
319
|
+
await showToast(ctx.client, 'Config updated. Restart opencode to apply.', 'info');
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
322
|
const overrides = await loadOverrides(locations);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-synced",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Sync global
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"description": "Sync global opencode config across machines via GitHub.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ian Hildebrand"
|
|
7
7
|
},
|