mirror of
https://github.com/bmad-code-org/BMAD-METHOD.git
synced 2026-09-19 08:11:52 +08:00
91f6c41be1
* docs: radical reduction of documentation scope for v6 beta Archive and basement unreviewed content to ship a focused, minimal doc set. Changes: - Archive stale how-to workflow guides (will rewrite for v6) - Archive outdated explanation and reference content - Move unreviewed content to basement for later review - Reorganize TEA docs into dedicated /tea/ section - Add workflow-map visual reference page - Simplify getting-started tutorial and sidebar navigation - Add explanation pages: brainstorming, adversarial-review, party-mode, quick-flow, advanced-elicitation - Fix base URL handling for subdirectory deployments (GitHub Pages forks) The goal is a minimal, accurate doc set for beta rather than comprehensive but potentially misleading content. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: restructure BMM and agents documentation by consolidating and flattening index files. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
117 lines
3.1 KiB
JavaScript
117 lines
3.1 KiB
JavaScript
const fs = require('fs-extra');
|
|
const path = require('node:path');
|
|
const yaml = require('yaml');
|
|
const { getProjectRoot } = require('./project-root');
|
|
|
|
/**
|
|
* Platform Codes Manager
|
|
* Loads and provides access to the centralized platform codes configuration
|
|
*/
|
|
class PlatformCodes {
|
|
constructor() {
|
|
this.configPath = path.join(getProjectRoot(), 'tools', 'platform-codes.yaml');
|
|
this.loadConfig();
|
|
}
|
|
|
|
/**
|
|
* Load the platform codes configuration
|
|
*/
|
|
loadConfig() {
|
|
try {
|
|
if (fs.existsSync(this.configPath)) {
|
|
const content = fs.readFileSync(this.configPath, 'utf8');
|
|
this.config = yaml.parse(content);
|
|
} else {
|
|
console.warn(`Platform codes config not found at ${this.configPath}`);
|
|
this.config = { platforms: {} };
|
|
}
|
|
} catch (error) {
|
|
console.error(`Error loading platform codes: ${error.message}`);
|
|
this.config = { platforms: {} };
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get all platform codes
|
|
* @returns {Object} All platform configurations
|
|
*/
|
|
getAllPlatforms() {
|
|
return this.config.platforms || {};
|
|
}
|
|
|
|
/**
|
|
* Get a specific platform configuration
|
|
* @param {string} code - Platform code
|
|
* @returns {Object|null} Platform configuration or null if not found
|
|
*/
|
|
getPlatform(code) {
|
|
return this.config.platforms[code] || null;
|
|
}
|
|
|
|
/**
|
|
* Check if a platform code is valid
|
|
* @param {string} code - Platform code to validate
|
|
* @returns {boolean} True if valid
|
|
*/
|
|
isValidPlatform(code) {
|
|
return code in this.config.platforms;
|
|
}
|
|
|
|
/**
|
|
* Get all preferred platforms
|
|
* @returns {Array} Array of preferred platform codes
|
|
*/
|
|
getPreferredPlatforms() {
|
|
return Object.entries(this.config.platforms)
|
|
.filter(([, config]) => config.preferred)
|
|
.map(([code]) => code);
|
|
}
|
|
|
|
/**
|
|
* Get platforms by category
|
|
* @param {string} category - Category to filter by
|
|
* @returns {Array} Array of platform codes in the category
|
|
*/
|
|
getPlatformsByCategory(category) {
|
|
return Object.entries(this.config.platforms)
|
|
.filter(([, config]) => config.category === category)
|
|
.map(([code]) => code);
|
|
}
|
|
|
|
/**
|
|
* Get platform display name
|
|
* @param {string} code - Platform code
|
|
* @returns {string} Display name or code if not found
|
|
*/
|
|
getDisplayName(code) {
|
|
const platform = this.getPlatform(code);
|
|
return platform ? platform.name : code;
|
|
}
|
|
|
|
/**
|
|
* Validate platform code format
|
|
* @param {string} code - Platform code to validate
|
|
* @returns {boolean} True if format is valid
|
|
*/
|
|
isValidFormat(code) {
|
|
const conventions = this.config.conventions || {};
|
|
const pattern = conventions.allowed_characters || 'a-z0-9-';
|
|
const maxLength = conventions.max_code_length || 20;
|
|
|
|
const regex = new RegExp(`^[${pattern}]+$`);
|
|
return regex.test(code) && code.length <= maxLength;
|
|
}
|
|
|
|
/**
|
|
* Get all platform codes as array
|
|
* @returns {Array} Array of platform codes
|
|
*/
|
|
getCodes() {
|
|
return Object.keys(this.config.platforms);
|
|
}
|
|
config = null;
|
|
}
|
|
|
|
// Export singleton instance
|
|
module.exports = new PlatformCodes();
|