refactor(installer): remove dead platform-codes helpers and YAML cruft
Delete unused PlatformCodes class from tools/cli/lib/. Strip dead helper functions from platform-codes.js (getPlatformInfo, getPreferredPlatforms, getPlatformsByCategory, etc). Remove unread category, description, categories, and conventions sections from platform-codes.yaml.
This commit is contained in:
parent
793edd0026
commit
d0f03869ca
|
|
@ -24,64 +24,6 @@ async function loadPlatformCodes() {
|
||||||
return _cachedPlatformCodes;
|
return _cachedPlatformCodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get platform information by code
|
|
||||||
* @param {string} platformCode - Platform code (e.g., 'claude-code', 'cursor')
|
|
||||||
* @returns {Object|null} Platform info or null if not found
|
|
||||||
*/
|
|
||||||
function getPlatformInfo(platformCode) {
|
|
||||||
if (!_cachedPlatformCodes) {
|
|
||||||
throw new Error('Platform codes not loaded. Call loadPlatformCodes() first.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return _cachedPlatformCodes.platforms[platformCode] || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all preferred platforms
|
|
||||||
* @returns {Promise<Array>} Array of preferred platform codes
|
|
||||||
*/
|
|
||||||
async function getPreferredPlatforms() {
|
|
||||||
const config = await loadPlatformCodes();
|
|
||||||
return Object.entries(config.platforms)
|
|
||||||
.filter(([_, info]) => info.preferred)
|
|
||||||
.map(([code, _]) => code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all platform codes by category
|
|
||||||
* @param {string} category - Category to filter by (ide, cli, tool, etc.)
|
|
||||||
* @returns {Promise<Array>} Array of platform codes in the category
|
|
||||||
*/
|
|
||||||
async function getPlatformsByCategory(category) {
|
|
||||||
const config = await loadPlatformCodes();
|
|
||||||
return Object.entries(config.platforms)
|
|
||||||
.filter(([_, info]) => info.category === category)
|
|
||||||
.map(([code, _]) => code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all platforms with installer config
|
|
||||||
* @returns {Promise<Array>} Array of platform codes that have installer config
|
|
||||||
*/
|
|
||||||
async function getConfigDrivenPlatforms() {
|
|
||||||
const config = await loadPlatformCodes();
|
|
||||||
return Object.entries(config.platforms)
|
|
||||||
.filter(([_, info]) => info.installer)
|
|
||||||
.map(([code, _]) => code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get platforms that use custom installers (no installer config)
|
|
||||||
* @returns {Promise<Array>} Array of platform codes with custom installers
|
|
||||||
*/
|
|
||||||
async function getCustomInstallerPlatforms() {
|
|
||||||
const config = await loadPlatformCodes();
|
|
||||||
return Object.entries(config.platforms)
|
|
||||||
.filter(([_, info]) => !info.installer)
|
|
||||||
.map(([code, _]) => code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the cached platform codes (useful for testing)
|
* Clear the cached platform codes (useful for testing)
|
||||||
*/
|
*/
|
||||||
|
|
@ -91,10 +33,5 @@ function clearCache() {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
loadPlatformCodes,
|
loadPlatformCodes,
|
||||||
getPlatformInfo,
|
|
||||||
getPreferredPlatforms,
|
|
||||||
getPlatformsByCategory,
|
|
||||||
getConfigDrivenPlatforms,
|
|
||||||
getCustomInstallerPlatforms,
|
|
||||||
clearCache,
|
clearCache,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,18 @@
|
||||||
# BMAD Platform Codes Configuration
|
# BMAD Platform Codes Configuration
|
||||||
# Central configuration for all platform/IDE codes used in the BMAD system
|
|
||||||
#
|
#
|
||||||
# This file defines:
|
# Each platform entry has:
|
||||||
# 1. Platform metadata (name, preferred status, category, description)
|
|
||||||
# 2. Installer configuration (target directories, templates, artifact types)
|
|
||||||
#
|
|
||||||
# Format:
|
|
||||||
# code: Platform identifier used internally
|
|
||||||
# name: Display name shown to users
|
# name: Display name shown to users
|
||||||
# preferred: Whether this platform is shown as a recommended option on install
|
# preferred: Whether shown as a recommended option on install
|
||||||
# category: Type of platform (ide, cli, tool, service)
|
# suspended: (optional) Message explaining why install is blocked
|
||||||
# description: Brief description of the platform
|
# installer:
|
||||||
# installer: Installation configuration (optional - omit for custom installers)
|
# target_dir: Directory where skill directories are installed
|
||||||
|
# legacy_targets: (optional) Old target dirs to clean up on reinstall
|
||||||
|
# ancestor_conflict_check: (optional) Refuse install when ancestor dir has BMAD files
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
antigravity:
|
antigravity:
|
||||||
name: "Google Antigravity"
|
name: "Google Antigravity"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Google's AI development environment"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .agent/workflows
|
- .agent/workflows
|
||||||
|
|
@ -27,8 +21,6 @@ platforms:
|
||||||
auggie:
|
auggie:
|
||||||
name: "Auggie"
|
name: "Auggie"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: cli
|
|
||||||
description: "AI development tool"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .augment/commands
|
- .augment/commands
|
||||||
|
|
@ -37,8 +29,6 @@ platforms:
|
||||||
claude-code:
|
claude-code:
|
||||||
name: "Claude Code"
|
name: "Claude Code"
|
||||||
preferred: true
|
preferred: true
|
||||||
category: cli
|
|
||||||
description: "Anthropic's official CLI for Claude"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .claude/commands
|
- .claude/commands
|
||||||
|
|
@ -48,8 +38,6 @@ platforms:
|
||||||
cline:
|
cline:
|
||||||
name: "Cline"
|
name: "Cline"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "AI coding assistant"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .clinerules/workflows
|
- .clinerules/workflows
|
||||||
|
|
@ -58,8 +46,6 @@ platforms:
|
||||||
codex:
|
codex:
|
||||||
name: "Codex"
|
name: "Codex"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: cli
|
|
||||||
description: "OpenAI Codex integration"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .codex/prompts
|
- .codex/prompts
|
||||||
|
|
@ -70,8 +56,6 @@ platforms:
|
||||||
codebuddy:
|
codebuddy:
|
||||||
name: "CodeBuddy"
|
name: "CodeBuddy"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Tencent Cloud Code Assistant - AI-powered coding companion"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .codebuddy/commands
|
- .codebuddy/commands
|
||||||
|
|
@ -80,8 +64,6 @@ platforms:
|
||||||
crush:
|
crush:
|
||||||
name: "Crush"
|
name: "Crush"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "AI development assistant"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .crush/commands
|
- .crush/commands
|
||||||
|
|
@ -90,8 +72,6 @@ platforms:
|
||||||
cursor:
|
cursor:
|
||||||
name: "Cursor"
|
name: "Cursor"
|
||||||
preferred: true
|
preferred: true
|
||||||
category: ide
|
|
||||||
description: "AI-first code editor"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .cursor/commands
|
- .cursor/commands
|
||||||
|
|
@ -100,8 +80,6 @@ platforms:
|
||||||
gemini:
|
gemini:
|
||||||
name: "Gemini CLI"
|
name: "Gemini CLI"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: cli
|
|
||||||
description: "Google's CLI for Gemini"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .gemini/commands
|
- .gemini/commands
|
||||||
|
|
@ -110,8 +88,6 @@ platforms:
|
||||||
github-copilot:
|
github-copilot:
|
||||||
name: "GitHub Copilot"
|
name: "GitHub Copilot"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "GitHub's AI pair programmer"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .github/agents
|
- .github/agents
|
||||||
|
|
@ -121,8 +97,6 @@ platforms:
|
||||||
iflow:
|
iflow:
|
||||||
name: "iFlow"
|
name: "iFlow"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "AI workflow automation"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .iflow/commands
|
- .iflow/commands
|
||||||
|
|
@ -131,8 +105,6 @@ platforms:
|
||||||
kilo:
|
kilo:
|
||||||
name: "KiloCoder"
|
name: "KiloCoder"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "AI coding platform"
|
|
||||||
suspended: "Kilo Code does not yet support the Agent Skills standard. Support is paused until they implement it. See https://github.com/kilocode/kilo-code/issues for updates."
|
suspended: "Kilo Code does not yet support the Agent Skills standard. Support is paused until they implement it. See https://github.com/kilocode/kilo-code/issues for updates."
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
|
|
@ -142,8 +114,6 @@ platforms:
|
||||||
kiro:
|
kiro:
|
||||||
name: "Kiro"
|
name: "Kiro"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Amazon's AI-powered IDE"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .kiro/steering
|
- .kiro/steering
|
||||||
|
|
@ -152,16 +122,12 @@ platforms:
|
||||||
ona:
|
ona:
|
||||||
name: "Ona"
|
name: "Ona"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Ona AI development environment"
|
|
||||||
installer:
|
installer:
|
||||||
target_dir: .ona/skills
|
target_dir: .ona/skills
|
||||||
|
|
||||||
opencode:
|
opencode:
|
||||||
name: "OpenCode"
|
name: "OpenCode"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "OpenCode terminal coding assistant"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .opencode/agents
|
- .opencode/agents
|
||||||
|
|
@ -174,24 +140,18 @@ platforms:
|
||||||
pi:
|
pi:
|
||||||
name: "Pi"
|
name: "Pi"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: cli
|
|
||||||
description: "Provider-agnostic terminal-native AI coding agent"
|
|
||||||
installer:
|
installer:
|
||||||
target_dir: .pi/skills
|
target_dir: .pi/skills
|
||||||
|
|
||||||
qoder:
|
qoder:
|
||||||
name: "Qoder"
|
name: "Qoder"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Qoder AI coding assistant"
|
|
||||||
installer:
|
installer:
|
||||||
target_dir: .qoder/skills
|
target_dir: .qoder/skills
|
||||||
|
|
||||||
qwen:
|
qwen:
|
||||||
name: "QwenCoder"
|
name: "QwenCoder"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Qwen AI coding assistant"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .qwen/commands
|
- .qwen/commands
|
||||||
|
|
@ -200,8 +160,6 @@ platforms:
|
||||||
roo:
|
roo:
|
||||||
name: "Roo Code"
|
name: "Roo Code"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Enhanced Cline fork"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .roo/commands
|
- .roo/commands
|
||||||
|
|
@ -210,8 +168,6 @@ platforms:
|
||||||
rovo-dev:
|
rovo-dev:
|
||||||
name: "Rovo Dev"
|
name: "Rovo Dev"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "Atlassian's Rovo development environment"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .rovodev/workflows
|
- .rovodev/workflows
|
||||||
|
|
@ -220,8 +176,6 @@ platforms:
|
||||||
trae:
|
trae:
|
||||||
name: "Trae"
|
name: "Trae"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "AI coding tool"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .trae/rules
|
- .trae/rules
|
||||||
|
|
@ -230,56 +184,7 @@ platforms:
|
||||||
windsurf:
|
windsurf:
|
||||||
name: "Windsurf"
|
name: "Windsurf"
|
||||||
preferred: false
|
preferred: false
|
||||||
category: ide
|
|
||||||
description: "AI-powered IDE with cascade flows"
|
|
||||||
installer:
|
installer:
|
||||||
legacy_targets:
|
legacy_targets:
|
||||||
- .windsurf/workflows
|
- .windsurf/workflows
|
||||||
target_dir: .windsurf/skills
|
target_dir: .windsurf/skills
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Installer Config Schema
|
|
||||||
# ============================================================================
|
|
||||||
#
|
|
||||||
# installer:
|
|
||||||
# target_dir: string # Directory where skill directories are installed
|
|
||||||
# legacy_targets: array (optional) # Old target dirs to clean up on reinstall (migration)
|
|
||||||
# - string # Relative path, e.g. .opencode/agent
|
|
||||||
# ancestor_conflict_check: boolean (optional) # Refuse install when ancestor dir has BMAD files
|
|
||||||
# # in the same target_dir (for IDEs that inherit
|
|
||||||
# # skills from parent directories)
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Platform Categories
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
categories:
|
|
||||||
ide:
|
|
||||||
name: "Integrated Development Environment"
|
|
||||||
description: "Full-featured code editors with AI assistance"
|
|
||||||
|
|
||||||
cli:
|
|
||||||
name: "Command Line Interface"
|
|
||||||
description: "Terminal-based tools"
|
|
||||||
|
|
||||||
tool:
|
|
||||||
name: "Development Tool"
|
|
||||||
description: "Standalone development utilities"
|
|
||||||
|
|
||||||
service:
|
|
||||||
name: "Cloud Service"
|
|
||||||
description: "Cloud-based development platforms"
|
|
||||||
|
|
||||||
extension:
|
|
||||||
name: "Editor Extension"
|
|
||||||
description: "Plugins for existing editors"
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Naming Conventions and Rules
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
conventions:
|
|
||||||
code_format: "lowercase-kebab-case"
|
|
||||||
name_format: "Title Case"
|
|
||||||
max_code_length: 20
|
|
||||||
allowed_characters: "a-z0-9-"
|
|
||||||
|
|
|
||||||
|
|
@ -1,116 +0,0 @@
|
||||||
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();
|
|
||||||
Loading…
Reference in New Issue