diff --git a/manager.js b/manager.js index 540de1b..5188c40 100644 --- a/manager.js +++ b/manager.js @@ -8,6 +8,8 @@ const entries = await fs.readdir(".", { withFileTypes: true }); // all files and let update = []; let added = []; +let removed = []; +let foundPlugins = new Set(); // Load existing registry or create new one let registry; @@ -38,6 +40,8 @@ for (const entry of entries) { const manifest = await fs.readJson(manifestPath); // manifest = data from manyplug.json const pluginName = manifest.name || entry.name; + foundPlugins.add(pluginName); + // Check if plugin exists in registry and version changed const existing = registry.plugins[pluginName]; // existing = plugin in registry.json if (!existing) { @@ -61,6 +65,17 @@ for (const entry of entries) { } } +// Check for removed plugins (exist in registry but not in filesystem) +for (const pluginName in registry.plugins) { + if (!foundPlugins.has(pluginName)) { + removed.push({ + name: pluginName, + version: registry.plugins[pluginName].version + }); + delete registry.plugins[pluginName]; + } +} + // Update timestamp registry.lastUpdated = new Date().toISOString(); @@ -68,7 +83,10 @@ await fs.writeJson(regPath, registry, { spaces: 2 }); console.log(chalk.green(`Registry synced\n`)); console.log(chalk.blue(` New plugins registred (${added.length}):`)); -console.log(chalk.blue(added.map(a => ` + ${a.name} (${a.version})`).join('\n'))); +console.log(chalk.blue(added.map(a => ` + ${a.name} (${a.version})`).join('\n') || ' (none)')); console.log(chalk.yellow(` Plugins updated (${update.length}):`)); -console.log(chalk.yellow(update.map(u => ` * ${u.name} (${u.oldVersion}) -> (${u.newVersion})`).join('\n'))); +console.log(chalk.yellow(update.map(u => ` * ${u.name} (${u.oldVersion}) -> (${u.newVersion})`).join('\n') || ' (none)')); + +console.log(chalk.red(` Plugins removed (${removed.length}):`)); +console.log(chalk.red(removed.map(r => ` - ${r.name} (${r.version})`).join('\n') || ' (none)')); diff --git a/registry.json b/registry.json index d7f6289..f9d7e33 100644 --- a/registry.json +++ b/registry.json @@ -1,5 +1,5 @@ { - "lastUpdated": "2026-04-17T19:02:06.357Z", + "lastUpdated": "2026-04-21T05:56:16.900Z", "plugins": { "a": { "name": "a", @@ -53,11 +53,12 @@ "service": false, "dependencies": {} }, - "xp": { - "name": "xp", - "version": "0.1.0", - "category": "social", - "service": true, + "obrigado": { + "name": "obrigado", + "author": "SyntaxError (https://git.maneos.net)", + "version": "1.0.0", + "category": "fun", + "service": false, "dependencies": {} } }