plugin-updater 1.1.1 → 1.1.3

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/dist/cli.js CHANGED
@@ -111,6 +111,18 @@ function addPluginEntry(configDir, url, branch, sync) {
111
111
  fs.writeFileSync(file, JSON.stringify(entries, null, 2), "utf8");
112
112
  console.log(`Added ${name} to ${file}`);
113
113
  }
114
+ else if (sync) {
115
+ // already present: honor --sync by enabling sync on the existing entry
116
+ const existing = entries.find((e) => e.name === name);
117
+ if (existing && existing.sync !== true) {
118
+ existing.sync = true;
119
+ fs.writeFileSync(file, JSON.stringify(entries, null, 2), "utf8");
120
+ console.log(`Enabled sync on ${name} in ${file}`);
121
+ }
122
+ else {
123
+ console.log(`${name} already present (sync on) in ${file}`);
124
+ }
125
+ }
114
126
  else {
115
127
  console.log(`${name} already present in ${file}`);
116
128
  }
package/dist/deploy.js CHANGED
@@ -95,6 +95,13 @@ export async function deployToExecutionDir(pluginName, executionPath, changed, c
95
95
  else if (fs.existsSync(path.join(distPath, "index.js"))) {
96
96
  deploySource = path.join(distPath, "index.js");
97
97
  }
98
+ // the build may have produced nothing (e.g. it failed, or the repo was deployed
99
+ // bundle-only with its source stripped) — skip gracefully rather than throwing
100
+ // ENOENT on the copy. Any already-deployed plugin/<name>.js stays in place.
101
+ if (!fs.existsSync(deploySource)) {
102
+ writeLog(`Skipping deploy for ${pluginName}: built file not found at ${deploySource}`, true);
103
+ return fs.existsSync(pluginExecutionFile);
104
+ }
98
105
  if (!fs.existsSync(executionPath))
99
106
  fs.mkdirSync(executionPath, { recursive: true });
100
107
  await callPluginCleanup(pluginExecutionFile, configDir);
package/dist/index.js CHANGED
@@ -123,10 +123,12 @@ export async function activate(opencodeHookInput) {
123
123
  await earlyLaunch(configDir, gitPlugins);
124
124
  }
125
125
  // consumers like the loader TUI import this module for its API only — running
126
- // the full updater sequence on import would print over their screen
127
- if (process.env.PLUGIN_UPDATER_LIBRARY_MODE !== "1") {
128
- // signal loaders (which activate later in the same process) that we are
129
- // self-driving updates, so their runEarlyLaunchHooks skips a duplicate pass
126
+ // the full updater sequence on import would print over their screen.
127
+ // The ACTIVATION guard makes self-activation idempotent PER PROCESS: opencode may
128
+ // load plugin-updater as more than one module instance (its npm-plugin copy plus a
129
+ // loader's separately-resolved copy), and each would otherwise run earlyLaunch. The
130
+ // first sets the flag; later instances (and the loaders' runEarlyLaunchHooks) skip.
131
+ if (process.env.PLUGIN_UPDATER_LIBRARY_MODE !== "1" && process.env.PLUGIN_UPDATER_ACTIVATION !== "1") {
130
132
  process.env.PLUGIN_UPDATER_ACTIVATION = "1";
131
133
  activate();
132
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugin-updater",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Plugin lifecycle manager for OpenCode and Claude Code launchers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",