opencode-sync-plugin 0.1.6 → 0.1.7

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 CHANGED
@@ -158,6 +158,8 @@ export const OpenCodeSyncPlugin: Plugin = async ({ project, client, $, directory
158
158
  };
159
159
  ```
160
160
 
161
+ This plugin exports both a named and default export so OpenCode can load it from npm reliably.
162
+
161
163
  ## Troubleshooting
162
164
 
163
165
  ### OpenCode won't start or shows blank screen
@@ -189,6 +191,8 @@ rm -rf ~/.cache/opencode/node_modules/opencode-sync-plugin
189
191
  opencode
190
192
  ```
191
193
 
194
+ If the issue persists, reinstall the latest version and clear the cache again.
195
+
192
196
  ### "Not authenticated" errors
193
197
 
194
198
  ```bash
@@ -2,6 +2,12 @@
2
2
  import { homedir } from "os";
3
3
  import { join } from "path";
4
4
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
5
+ async function safeLog(client, entry) {
6
+ try {
7
+ await client?.app?.log?.(entry);
8
+ } catch {
9
+ }
10
+ }
5
11
  var CONFIG_DIR = join(homedir(), ".config", "opencode-sync");
6
12
  var CONFIG_FILE = join(CONFIG_DIR, "config.json");
7
13
  function readConfigFile() {
@@ -58,7 +64,7 @@ async function syncSession(session, client) {
58
64
  const apiKey = getApiKey();
59
65
  const siteUrl = getSiteUrl();
60
66
  if (!apiKey || !siteUrl) {
61
- await client.app.log({
67
+ await safeLog(client, {
62
68
  service: "opencode-sync",
63
69
  level: "warn",
64
70
  message: "Not authenticated. Run: opencode-sync login"
@@ -86,14 +92,14 @@ async function syncSession(session, client) {
86
92
  });
87
93
  if (!response.ok) {
88
94
  const errorText = await response.text();
89
- await client.app.log({
95
+ await safeLog(client, {
90
96
  service: "opencode-sync",
91
97
  level: "error",
92
98
  message: `Session sync failed: ${errorText}`
93
99
  });
94
100
  }
95
101
  } catch (e) {
96
- await client.app.log({
102
+ await safeLog(client, {
97
103
  service: "opencode-sync",
98
104
  level: "error",
99
105
  message: `Session sync error: ${e}`
@@ -126,14 +132,14 @@ async function syncMessage(sessionId, message, client) {
126
132
  });
127
133
  if (!response.ok) {
128
134
  const errorText = await response.text();
129
- await client.app.log({
135
+ await safeLog(client, {
130
136
  service: "opencode-sync",
131
137
  level: "error",
132
138
  message: `Message sync failed: ${errorText}`
133
139
  });
134
140
  }
135
141
  } catch (e) {
136
- await client.app.log({
142
+ await safeLog(client, {
137
143
  service: "opencode-sync",
138
144
  level: "error",
139
145
  message: `Message sync error: ${e}`
@@ -190,13 +196,13 @@ var syncedSessions = /* @__PURE__ */ new Set();
190
196
  var OpenCodeSyncPlugin = async ({ project, client, $, directory, worktree }) => {
191
197
  const cfg = getConfig();
192
198
  if (!cfg || !cfg.apiKey) {
193
- await client.app.log({
199
+ await safeLog(client, {
194
200
  service: "opencode-sync",
195
201
  level: "warn",
196
202
  message: "Not configured. Run: opencode-sync login"
197
203
  });
198
204
  } else {
199
- await client.app.log({
205
+ await safeLog(client, {
200
206
  service: "opencode-sync",
201
207
  level: "info",
202
208
  message: "Plugin initialized",
@@ -251,10 +257,12 @@ var OpenCodeSyncPlugin = async ({ project, client, $, directory, worktree }) =>
251
257
  }
252
258
  };
253
259
  };
260
+ var index_default = OpenCodeSyncPlugin;
254
261
 
255
262
  export {
256
263
  getConfig,
257
264
  setConfig,
258
265
  clearConfig,
259
- OpenCodeSyncPlugin
266
+ OpenCodeSyncPlugin,
267
+ index_default
260
268
  };
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  clearConfig,
4
4
  getConfig,
5
5
  setConfig
6
- } from "./chunk-46RJJUZ6.js";
6
+ } from "./chunk-GVXT3A2F.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { readFileSync, existsSync } from "fs";
package/dist/index.d.ts CHANGED
@@ -39,4 +39,4 @@ declare function clearConfig(): void;
39
39
  */
40
40
  declare const OpenCodeSyncPlugin: Plugin;
41
41
 
42
- export { OpenCodeSyncPlugin, clearConfig, getConfig, setConfig };
42
+ export { OpenCodeSyncPlugin, clearConfig, OpenCodeSyncPlugin as default, getConfig, setConfig };
package/dist/index.js CHANGED
@@ -2,11 +2,13 @@ import {
2
2
  OpenCodeSyncPlugin,
3
3
  clearConfig,
4
4
  getConfig,
5
+ index_default,
5
6
  setConfig
6
- } from "./chunk-46RJJUZ6.js";
7
+ } from "./chunk-GVXT3A2F.js";
7
8
  export {
8
9
  OpenCodeSyncPlugin,
9
10
  clearConfig,
11
+ index_default as default,
10
12
  getConfig,
11
13
  setConfig
12
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sync-plugin",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Sync your OpenCode sessions to the cloud",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",