fix: expansion install config

This commit is contained in:
Brian Madison
2025-06-28 01:57:02 -05:00
parent c70f1a056b
commit 50d17ed65d
16 changed files with 64 additions and 97 deletions

View File

@@ -77,24 +77,45 @@ class ConfigLoader {
const expansionPacks = [];
for (const entry of entries) {
if (entry.isDirectory()) {
const manifestPath = path.join(expansionPacksDir, entry.name, 'manifest.yml');
if (entry.isDirectory() && !entry.name.startsWith('.')) {
const packPath = path.join(expansionPacksDir, entry.name);
const configPath = path.join(packPath, 'config.yml');
try {
const manifestContent = await fs.readFile(manifestPath, 'utf8');
const manifest = yaml.load(manifestContent);
// Read config.yml
const configContent = await fs.readFile(configPath, 'utf8');
const config = yaml.load(configContent);
expansionPacks.push({
id: entry.name,
name: manifest.name || entry.name,
description: manifest.description || 'No description available',
version: manifest.version || '1.0.0',
author: manifest.author || 'Unknown',
manifestPath: manifestPath,
dependencies: manifest.dependencies || []
name: config.name || entry.name,
description: config['short-title'] || config.description || 'No description available',
fullDescription: config.description || config['short-title'] || 'No description available',
version: config.version || '1.0.0',
author: config.author || 'BMAD Team',
packPath: packPath,
dependencies: config.dependencies?.agents || []
});
} catch (error) {
console.warn(`Failed to read manifest for expansion pack ${entry.name}: ${error.message}`);
// Fallback if config.yml doesn't exist or can't be read
console.warn(`Failed to read config for expansion pack ${entry.name}: ${error.message}`);
// Try to derive info from directory name as fallback
const name = entry.name
.split('-')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
expansionPacks.push({
id: entry.name,
name: name,
description: 'No description available',
fullDescription: 'No description available',
version: '1.0.0',
author: 'BMAD Team',
packPath: packPath,
dependencies: []
});
}
}
}

View File

@@ -817,7 +817,7 @@ class Installer {
continue;
}
const expansionPackDir = path.dirname(pack.manifestPath);
const expansionPackDir = pack.packPath;
// Create dedicated dot folder for this expansion pack
const expansionDotFolder = path.join(installDir, `.${packId}`);
@@ -860,10 +860,22 @@ class Installer {
}
}
// Copy manifest to the expansion pack's dot folder
const manifestDestPath = path.join(expansionDotFolder, 'manifest.yml');
if (await fileManager.copyFile(pack.manifestPath, manifestDestPath)) {
installedFiles.push(path.join(`.${packId}`, 'manifest.yml'));
// Copy config.yml
const configPath = path.join(expansionPackDir, 'config.yml');
if (await fileManager.pathExists(configPath)) {
const configDestPath = path.join(expansionDotFolder, 'config.yml');
if (await fileManager.copyFile(configPath, configDestPath)) {
installedFiles.push(path.join(`.${packId}`, 'config.yml'));
}
}
// Copy README if it exists
const readmePath = path.join(expansionPackDir, 'README.md');
if (await fileManager.pathExists(readmePath)) {
const readmeDestPath = path.join(expansionDotFolder, 'README.md');
if (await fileManager.copyFile(readmePath, readmeDestPath)) {
installedFiles.push(path.join(`.${packId}`, 'README.md'));
}
}
// Copy common/ items to expansion pack folder