plugin-updater 1.0.29 → 1.0.31

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -271,10 +271,25 @@ function updatePlugin(pluginName, gitUrl, branch, commitHash, updateInterval = 1
271
271
  executeGit(`git pull --ff-only origin ${branch}`, targetDir);
272
272
  }
273
273
  else {
274
+ // the updater owns repos/: hard-sync to the remote so force-pushed
275
+ // branches and rewritten submodule history cannot strand the clone
276
+ executeGit("git fetch origin", targetDir);
274
277
  executeGit("git checkout main || git checkout master", targetDir);
275
- executeGit("git pull --ff-only", targetDir);
278
+ executeGit("git reset --hard @{upstream}", targetDir);
279
+ }
280
+ executeGit("git submodule sync --recursive", targetDir);
281
+ const submodulesOk = executeGit("git submodule update --init --recursive --force", targetDir);
282
+ if (!submodulesOk) {
283
+ writeLog(`Submodule sync failed for ${pluginName}, recloning`, true);
284
+ try {
285
+ fs.rmSync(targetDir, { recursive: true, force: true });
286
+ }
287
+ catch { /* ignore */ }
288
+ const recloneBranchFlag = branch ? `--branch ${branch}` : "";
289
+ executeGit(`git clone --recurse-submodules ${recloneBranchFlag} ${gitUrl} ${pluginName}`, reposDir);
290
+ fs.writeFileSync(lastCheckFile, Date.now().toString());
291
+ didChange = true;
276
292
  }
277
- executeGit("git submodule update --init --recursive", targetDir);
278
293
  let afterHash = "";
279
294
  try {
280
295
  afterHash = execSync("git rev-parse HEAD", { cwd: targetDir }).toString().trim();
@@ -412,7 +427,8 @@ export async function updatePluginPublic(pluginName, gitUrl, branch, commitHash)
412
427
  writeLog(`Public API update call for ${pluginName}`);
413
428
  const appName = process.argv.join(" ").includes("claude") ? "claude" : "opencode";
414
429
  const configDir = getAppConfigDir(appName);
415
- const result = updatePlugin(pluginName, gitUrl, branch, commitHash ?? null);
430
+ // interval 0: an explicit update request must never fast-path-skip
431
+ const result = updatePlugin(pluginName, gitUrl, branch, commitHash ?? null, 0);
416
432
  await deployToExecutionDir(pluginName, path.join(configDir, "plugin"), result.changed, configDir);
417
433
  }
418
434
  export async function earlyLaunch(configDir, plugins) {
@@ -442,12 +458,19 @@ export async function earlyLaunch(configDir, plugins) {
442
458
  return;
443
459
  }
444
460
  for (const plugin of plugins) {
445
- if (!plugin.enabled)
461
+ // absence of the enabled key means enabled, matching the loader TUI
462
+ if (plugin.enabled === false) {
463
+ writeLog(`Skipping disabled plugin ${plugin.name}`);
446
464
  continue;
447
- if (plugin.autoUpdate === false)
465
+ }
466
+ if (plugin.autoUpdate === false) {
467
+ writeLog(`Skipping auto-update for ${plugin.name} (autoUpdate off)`);
448
468
  continue;
449
- if (!plugin.url)
469
+ }
470
+ if (!plugin.url) {
471
+ writeLog(`Skipping ${plugin.name}: no url in plugins.json`, true);
450
472
  continue;
473
+ }
451
474
  writeLog(`Processing earlyLaunch for ${plugin.name}`);
452
475
  try {
453
476
  const updateResult = updatePlugin(plugin.name, plugin.url, plugin.branch, null, plugin.updateInterval ?? 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugin-updater",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Plugin lifecycle manager for OpenCode and Claude Code launchers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",