plugin-updater 1.0.30 → 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 +19 -3
  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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugin-updater",
3
- "version": "1.0.30",
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",