plugin-updater 1.0.32 → 1.0.33
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/index.js +38 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -366,6 +366,12 @@ async function deployToExecutionDir(pluginName, executionPath, changed, configDi
|
|
|
366
366
|
if (fs.existsSync(packageJsonPath)) {
|
|
367
367
|
try {
|
|
368
368
|
buildInTempDir(pluginName, sourceDir);
|
|
369
|
+
const runtimeDeps = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")).dependencies;
|
|
370
|
+
if (runtimeDeps && Object.keys(runtimeDeps).length > 0) {
|
|
371
|
+
writeLog(`Installing runtime dependencies for ${pluginName}`);
|
|
372
|
+
execSync("npm install --omit=dev", { cwd: sourceDir, stdio: "pipe" });
|
|
373
|
+
writeLog(`Finished runtime dependencies for ${pluginName}`);
|
|
374
|
+
}
|
|
369
375
|
}
|
|
370
376
|
catch (error) {
|
|
371
377
|
const err = error;
|
|
@@ -407,6 +413,7 @@ async function deployToExecutionDir(pluginName, executionPath, changed, configDi
|
|
|
407
413
|
const err = e;
|
|
408
414
|
writeLog(`Copy failed for ${pluginName}: ${err.message}`, true);
|
|
409
415
|
}
|
|
416
|
+
applyClaudeManifest(sourceDir, configDir, pluginName);
|
|
410
417
|
// Claude Code never imports deployed plugin files, so under claude the
|
|
411
418
|
// updater is the runtime and invokes the plugin's activate() itself
|
|
412
419
|
if (getAppName() === "claude") {
|
|
@@ -424,6 +431,37 @@ async function deployToExecutionDir(pluginName, executionPath, changed, configDi
|
|
|
424
431
|
}
|
|
425
432
|
return true;
|
|
426
433
|
}
|
|
434
|
+
function applyClaudeManifest(sourceDir, configDir, pluginName) {
|
|
435
|
+
if (getAppName() !== "claude")
|
|
436
|
+
return;
|
|
437
|
+
try {
|
|
438
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(sourceDir, "package.json"), "utf8"));
|
|
439
|
+
const manifest = pkg.claudeHub;
|
|
440
|
+
if (!manifest)
|
|
441
|
+
return;
|
|
442
|
+
if (manifest.env && typeof manifest.env === "object") {
|
|
443
|
+
const settingsPath = path.join(configDir, "settings.json");
|
|
444
|
+
let settings = {};
|
|
445
|
+
try {
|
|
446
|
+
settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
|
|
447
|
+
}
|
|
448
|
+
catch { /* fresh file */ }
|
|
449
|
+
const env = (settings.env ?? {});
|
|
450
|
+
for (const [key, value] of Object.entries(manifest.env)) {
|
|
451
|
+
env[key] = String(value);
|
|
452
|
+
writeLog(`settings.json env ${key} set by ${pluginName}`);
|
|
453
|
+
}
|
|
454
|
+
settings.env = env;
|
|
455
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), "utf8");
|
|
456
|
+
}
|
|
457
|
+
if (manifest.daemon?.script) {
|
|
458
|
+
writeLog(`${pluginName} defines a daemon (${manifest.daemon.script}) which the updater does not manage yet`, true);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
catch (e) {
|
|
462
|
+
writeLog(`claudeHub manifest handling failed for ${pluginName}: ${e.message}`, true);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
427
465
|
async function pluginUpdaterEntry(input) {
|
|
428
466
|
const appName = getAppName();
|
|
429
467
|
const configDir = getAppConfigDir(appName);
|