opencode-plugin-auto-update 0.2.0 → 0.3.0
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 +1 -1
- package/dist/index.js +17 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Automatically updates OpenCode plugins in the background on startup. No prompts,
|
|
|
16
16
|
|
|
17
17
|
- Zero startup delay (async, detached update)
|
|
18
18
|
- Bun-first installs with npm fallback
|
|
19
|
-
-
|
|
19
|
+
- Shows a brief toast summary after updates
|
|
20
20
|
- Skips local/path/git plugins
|
|
21
21
|
|
|
22
22
|
## 📦 Installation
|
package/dist/index.js
CHANGED
|
@@ -190,6 +190,21 @@ async function runAutoUpdate(options = {}) {
|
|
|
190
190
|
const updatedConfig = { ...config, [key]: updateResult.plugins };
|
|
191
191
|
await writeConfig(configPath, updatedConfig);
|
|
192
192
|
}
|
|
193
|
+
const hasOcx = await commandExists("ocx");
|
|
194
|
+
if (hasOcx) {
|
|
195
|
+
log("[auto-update] Found ocx, checking for extension updates...");
|
|
196
|
+
const ocxResult = await runCommand("ocx", ["update"]);
|
|
197
|
+
if (ocxResult.code === 0) {
|
|
198
|
+
const output = ocxResult.stdout.trim();
|
|
199
|
+
if (output) {
|
|
200
|
+
log("[auto-update] ocx update result:", output);
|
|
201
|
+
} else {
|
|
202
|
+
log("[auto-update] ocx update complete (no output).");
|
|
203
|
+
}
|
|
204
|
+
} else {
|
|
205
|
+
error("[auto-update] ocx update failed:", ocxResult.stderr || ocxResult.stdout);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
193
208
|
await writeThrottleState(
|
|
194
209
|
{ ...state, lastRun: now, lastSuccess: Date.now() },
|
|
195
210
|
{ debug, configDir }
|
|
@@ -405,6 +420,7 @@ async function src_default(ctx) {
|
|
|
405
420
|
let lastToastMessage = null;
|
|
406
421
|
const localConfig = await readLocalConfig();
|
|
407
422
|
configIgnoreThrottle = localConfig.ignoreThrottle ?? false;
|
|
423
|
+
const configDebug = localConfig.debug ?? false;
|
|
408
424
|
const shouldIgnoreThrottle = () => envBypassThrottle || configIgnoreThrottle;
|
|
409
425
|
const notifyUser = async (message) => {
|
|
410
426
|
await writeDebug("notifyUser invoked");
|
|
@@ -423,8 +439,6 @@ async function src_default(ctx) {
|
|
|
423
439
|
});
|
|
424
440
|
await writeDebug("toast shown");
|
|
425
441
|
}
|
|
426
|
-
console.log(message);
|
|
427
|
-
await writeDebug("console fallback used");
|
|
428
442
|
};
|
|
429
443
|
const startUpdate = () => {
|
|
430
444
|
if (updateStarted) {
|
|
@@ -435,7 +449,7 @@ async function src_default(ctx) {
|
|
|
435
449
|
const logEntries = [];
|
|
436
450
|
const errorEntries = [];
|
|
437
451
|
runAutoUpdate({
|
|
438
|
-
debug:
|
|
452
|
+
debug: configDebug,
|
|
439
453
|
ignoreThrottle: shouldIgnoreThrottle(),
|
|
440
454
|
onLog: (message) => logEntries.push(message),
|
|
441
455
|
onError: (message) => errorEntries.push(message)
|
|
@@ -444,11 +458,9 @@ async function src_default(ctx) {
|
|
|
444
458
|
void writeDebug(`update finished (logs=${logEntries.length}, errors=${errorEntries.length})`);
|
|
445
459
|
notifyUser(updateMessage).catch((error) => {
|
|
446
460
|
void writeDebug(`notifyUser error: ${String(error)}`);
|
|
447
|
-
console.error("[opencode-plugin-auto-update] Failed to notify user:", error);
|
|
448
461
|
});
|
|
449
462
|
}).catch((error) => {
|
|
450
463
|
void writeDebug(`runAutoUpdate error: ${String(error)}`);
|
|
451
|
-
console.error("[opencode-plugin-auto-update] Update check failed:", error);
|
|
452
464
|
});
|
|
453
465
|
};
|
|
454
466
|
startupTimer = setTimeout(() => {
|