UNPKG

@cloudkinetix/bmad-enhanced

Version:

Cloud-Kinetix enhanced fork of BMAD-METHOD - Breakthrough Method of Agile AI-driven Development with robust versioning and unified validation.

84 lines (71 loc) 2.06 kB
const configLoader = require("./config-loader"); /** * IDE Discovery utility - Auto-discovers supported IDEs and expansion packs * Makes the system future-proof by avoiding hardcoded lists */ class IDEDiscovery { constructor() { this.cachedIDEs = null; this.cachedExpansionPacks = null; } /** * Auto-discover supported IDEs from configuration */ async getAvailableIDEs() { if (this.cachedIDEs === null) { this.cachedIDEs = await configLoader.getAvailableIDEs(); } return this.cachedIDEs; } /** * Auto-discover available expansion packs */ async getAvailableExpansionPacks() { if (this.cachedExpansionPacks === null) { const packs = await configLoader.getAvailableExpansionPacks(); this.cachedExpansionPacks = packs.map((pack) => pack.id); } return this.cachedExpansionPacks; } /** * Get all available IDEs as a default list for CLI options */ async getDefaultIDEList() { const ides = await this.getAvailableIDEs(); return ides; } /** * Validate that requested IDEs are supported */ async validateIDEs(requestedIDEs) { const available = await this.getAvailableIDEs(); const invalid = requestedIDEs.filter((ide) => !available.includes(ide)); if (invalid.length > 0) { throw new Error( `Unsupported IDE(s): ${invalid.join(", ")}. Available: ${available.join(", ")}` ); } return true; } /** * Validate that requested expansion packs exist */ async validateExpansionPacks(requestedPacks) { const available = await this.getAvailableExpansionPacks(); const invalid = requestedPacks.filter((pack) => !available.includes(pack)); if (invalid.length > 0) { throw new Error( `Unknown expansion pack(s): ${invalid.join(", ")}. Available: ${available.join(", ")}` ); } return true; } /** * Clear cache to force re-discovery */ clearCache() { this.cachedIDEs = null; this.cachedExpansionPacks = null; } } module.exports = new IDEDiscovery();