@cloudkinetix/bmad-enhanced
Version:
Cloud-Kinetix enhanced fork of BMAD-METHOD - Breakthrough Method of Agile AI-driven Development with robust versioning and unified validation.
105 lines (92 loc) • 2.77 kB
JavaScript
/**
* Simplified Config Loader for CK Enhancements
*
* Minimal configuration handling for CK-specific features.
*/
const fs = require('fs-extra');
const path = require('path');
const yaml = require('js-yaml');
class ConfigLoader {
constructor() {
this.configPath = path.join(__dirname, '../config/ck-defaults.yaml');
this.config = null;
}
async loadConfig() {
if (!this.config) {
try {
const content = await fs.readFile(this.configPath, 'utf8');
this.config = yaml.load(content) || {};
} catch (error) {
// Default configuration if file doesn't exist
this.config = {
profiles: {
full: {
name: 'Full Installation',
ides: 'all',
expansionPacks: 'all'
},
default: {
name: 'Default Installation',
ides: ['cursor', 'claude-code'],
expansionPacks: []
}
}
};
}
}
return this.config;
}
async getInstallationProfile(profileName) {
const config = await this.loadConfig();
return config.profiles?.[profileName];
}
async getAllAvailableIDEs() {
// All supported IDEs
return [
'cursor',
'claude-code',
'windsurf',
'roo',
'cline',
'gemini',
'github-copilot',
];
}
async getAvailableExpansionPacks() {
// Scan expansion-packs directory
const expansionPacksDir = path.join(__dirname, '../../expansion-packs');
const packs = [];
try {
const entries = await fs.readdir(expansionPacksDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory() && !entry.name.startsWith('.')) {
const manifestPath = path.join(expansionPacksDir, entry.name, 'manifest.yaml');
if (await fs.pathExists(manifestPath)) {
try {
const content = await fs.readFile(manifestPath, 'utf8');
const manifest = yaml.load(content);
packs.push({
id: entry.name,
name: manifest.name || entry.name,
version: manifest.version || '1.0.0',
description: manifest.description || ''
});
} catch (e) {
// Include pack even if manifest is invalid
packs.push({
id: entry.name,
name: entry.name,
version: '1.0.0',
description: ''
});
}
}
}
}
} catch (error) {
console.warn('Could not scan expansion packs:', error.message);
}
return packs;
}
}
module.exports = new ConfigLoader();