fix(installer): pass version and repoUrl to manifest for custom plugins

installFromResolution was passing empty strings for version and repoUrl,
which the manifest stores as null. Now threads the repo URL from ui.js
through resolvePlugin into each ResolvedModule, and passes the plugin
version and URL to the manifest correctly.
This commit is contained in:
Brian Madison 2026-04-09 08:51:57 -05:00
parent 489067fdda
commit ffe84a9f17
3 changed files with 9 additions and 7 deletions

View File

@ -188,15 +188,17 @@ class CustomModuleManager {
* Results are cached in _resolutionCache keyed by module code. * Results are cached in _resolutionCache keyed by module code.
* @param {string} repoPath - Absolute path to the cloned repository * @param {string} repoPath - Absolute path to the cloned repository
* @param {Object} plugin - Raw plugin object from marketplace.json * @param {Object} plugin - Raw plugin object from marketplace.json
* @param {string} [repoUrl] - Original GitHub URL for manifest tracking
* @returns {Promise<Array<Object>>} Array of ResolvedModule objects * @returns {Promise<Array<Object>>} Array of ResolvedModule objects
*/ */
async resolvePlugin(repoPath, plugin) { async resolvePlugin(repoPath, plugin, repoUrl) {
const { PluginResolver } = require('./plugin-resolver'); const { PluginResolver } = require('./plugin-resolver');
const resolver = new PluginResolver(); const resolver = new PluginResolver();
const resolved = await resolver.resolve(repoPath, plugin); const resolved = await resolver.resolve(repoPath, plugin);
// Cache each resolved module by its code for lookup during install // Stamp repo URL onto each resolved module for manifest tracking
for (const mod of resolved) { for (const mod of resolved) {
if (repoUrl) mod.repoUrl = repoUrl;
CustomModuleManager._resolutionCache.set(mod.code, mod); CustomModuleManager._resolutionCache.set(mod.code, mod);
} }

View File

@ -336,10 +336,10 @@ class OfficialModules {
const manifestObj = new Manifest(); const manifestObj = new Manifest();
await manifestObj.addModule(bmadDir, resolved.code, { await manifestObj.addModule(bmadDir, resolved.code, {
version: resolved.version || '', version: resolved.version || null,
source: `custom:${resolved.pluginName}`, source: 'custom',
npmPackage: '', npmPackage: null,
repoUrl: '', repoUrl: resolved.repoUrl || null,
}); });
return { success: true, module: resolved.code, path: targetPath, versionInfo: { version: resolved.version || '' } }; return { success: true, module: resolved.code, path: targetPath, versionInfo: { version: resolved.version || '' } };

View File

@ -881,7 +881,7 @@ class UI {
const allResolved = []; const allResolved = [];
for (const plugin of plugins) { for (const plugin of plugins) {
try { try {
const resolved = await customMgr.resolvePlugin(repoPath, plugin.rawPlugin); const resolved = await customMgr.resolvePlugin(repoPath, plugin.rawPlugin, url.trim());
if (resolved.length > 0) { if (resolved.length > 0) {
allResolved.push(...resolved); allResolved.push(...resolved);
} else { } else {