mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-29 16:14:59 +00:00
we only need one yaml lib
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const path = require('node:path');
|
||||
const fs = require('fs-extra');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
const chalk = require('chalk');
|
||||
const inquirer = require('inquirer');
|
||||
const { getProjectRoot, getModulePath } = require('../../../lib/project-root');
|
||||
@@ -109,7 +109,7 @@ class ConfigCollector {
|
||||
if (await fs.pathExists(moduleConfigPath)) {
|
||||
try {
|
||||
const content = await fs.readFile(moduleConfigPath, 'utf8');
|
||||
const moduleConfig = yaml.load(content);
|
||||
const moduleConfig = yaml.parse(content);
|
||||
if (moduleConfig) {
|
||||
this.existingConfig[entry.name] = moduleConfig;
|
||||
foundAny = true;
|
||||
@@ -238,7 +238,7 @@ class ConfigCollector {
|
||||
}
|
||||
|
||||
const configContent = await fs.readFile(configPath, 'utf8');
|
||||
const moduleConfig = yaml.load(configContent);
|
||||
const moduleConfig = yaml.parse(configContent);
|
||||
|
||||
if (!moduleConfig) {
|
||||
return false;
|
||||
@@ -514,7 +514,7 @@ class ConfigCollector {
|
||||
}
|
||||
|
||||
const configContent = await fs.readFile(configPath, 'utf8');
|
||||
const moduleConfig = yaml.load(configContent);
|
||||
const moduleConfig = yaml.parse(configContent);
|
||||
|
||||
if (!moduleConfig) {
|
||||
return;
|
||||
|
||||
@@ -31,7 +31,7 @@ class CustomModuleCache {
|
||||
}
|
||||
|
||||
const content = await fs.readFile(this.manifestPath, 'utf8');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
return yaml.parse(content) || {};
|
||||
}
|
||||
|
||||
@@ -39,11 +39,10 @@ class CustomModuleCache {
|
||||
* Update cache manifest
|
||||
*/
|
||||
async updateCacheManifest(manifest) {
|
||||
const yaml = require('js-yaml');
|
||||
const content = yaml.dump(manifest, {
|
||||
const yaml = require('yaml');
|
||||
const content = yaml.stringify(manifest, {
|
||||
indent: 2,
|
||||
lineWidth: -1,
|
||||
noRefs: true,
|
||||
lineWidth: 0,
|
||||
sortKeys: false,
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ const fs = require('fs-extra');
|
||||
const path = require('node:path');
|
||||
const glob = require('glob');
|
||||
const chalk = require('chalk');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
|
||||
/**
|
||||
* Dependency Resolver for BMAD modules
|
||||
@@ -147,7 +147,7 @@ class DependencyResolver {
|
||||
// Quote values with backticks to make them valid YAML
|
||||
yamlContent = yamlContent.replaceAll(/: `([^`]+)`/g, ': "$1"');
|
||||
|
||||
const frontmatter = yaml.load(yamlContent);
|
||||
const frontmatter = yaml.parse(yamlContent);
|
||||
if (frontmatter.dependencies) {
|
||||
const deps = Array.isArray(frontmatter.dependencies) ? frontmatter.dependencies : [frontmatter.dependencies];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const path = require('node:path');
|
||||
const fs = require('fs-extra');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
const { Manifest } = require('./manifest');
|
||||
|
||||
class Detector {
|
||||
@@ -237,7 +237,7 @@ class Detector {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
const manifestContent = await fs.readFile(manifestPath, 'utf8');
|
||||
const manifest = yaml.parse(manifestContent);
|
||||
// V6+ manifest has installation.version
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const path = require('node:path');
|
||||
const fs = require('fs-extra');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
|
||||
/**
|
||||
* Manages IDE configuration persistence
|
||||
@@ -61,10 +61,9 @@ class IdeConfigManager {
|
||||
configuration: configuration || {},
|
||||
};
|
||||
|
||||
const yamlContent = yaml.dump(configData, {
|
||||
const yamlContent = yaml.stringify(configData, {
|
||||
indent: 2,
|
||||
lineWidth: -1,
|
||||
noRefs: true,
|
||||
lineWidth: 0,
|
||||
sortKeys: false,
|
||||
});
|
||||
|
||||
@@ -88,7 +87,7 @@ class IdeConfigManager {
|
||||
|
||||
try {
|
||||
const content = await fs.readFile(configPath, 'utf8');
|
||||
const config = yaml.load(content);
|
||||
const config = yaml.parse(content);
|
||||
return config;
|
||||
} catch (error) {
|
||||
console.warn(`Warning: Failed to load IDE config for ${ideName}:`, error.message);
|
||||
|
||||
@@ -18,6 +18,7 @@ const { CLIUtils } = require('../../../lib/cli-utils');
|
||||
const { ManifestGenerator } = require('./manifest-generator');
|
||||
const { IdeConfigManager } = require('./ide-config-manager');
|
||||
const { CustomHandler } = require('../custom/handler');
|
||||
const { filterCustomizationData } = require('../../../lib/agent/compiler');
|
||||
|
||||
class Installer {
|
||||
constructor() {
|
||||
@@ -1457,7 +1458,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
* @param {Object} moduleConfigs - Collected configuration values
|
||||
*/
|
||||
async generateModuleConfigs(bmadDir, moduleConfigs) {
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
|
||||
// Extract core config values to share with other modules
|
||||
const coreConfig = moduleConfigs.core || {};
|
||||
@@ -1504,11 +1505,10 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
}
|
||||
|
||||
// Convert config to YAML
|
||||
let yamlContent = yaml.dump(finalConfig, {
|
||||
let yamlContent = yaml.stringify(finalConfig, {
|
||||
indent: 2,
|
||||
lineWidth: -1,
|
||||
noRefs: true,
|
||||
sortKeys: false,
|
||||
lineWidth: 0,
|
||||
minContentWidth: 0,
|
||||
});
|
||||
|
||||
// If we have core values, reorganize the YAML to group them with their comment
|
||||
@@ -1949,7 +1949,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
|
||||
if (customizeExists) {
|
||||
const customizeContent = await fs.readFile(customizePath, 'utf8');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
const customizeYaml = yaml.parse(customizeContent);
|
||||
|
||||
// Detect what fields are customized (similar to rebuildAgentFiles)
|
||||
@@ -2040,8 +2040,8 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
|
||||
if (customizeExists) {
|
||||
const customizeContent = await fs.readFile(customizePath, 'utf8');
|
||||
const yaml = require('js-yaml');
|
||||
const customizeYaml = yaml.load(customizeContent);
|
||||
const yaml = require('yaml');
|
||||
const customizeYaml = yaml.parse(customizeContent);
|
||||
|
||||
// Detect what fields are customized
|
||||
if (customizeYaml) {
|
||||
@@ -2085,18 +2085,21 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
customizeData = yaml.parse(customizeContent);
|
||||
}
|
||||
|
||||
// Build agent answers from customize data
|
||||
// Build agent answers from customize data (filter empty values)
|
||||
const answers = {};
|
||||
if (customizeData.persona) {
|
||||
Object.assign(answers, customizeData.persona);
|
||||
Object.assign(answers, filterCustomizationData(customizeData.persona));
|
||||
}
|
||||
if (customizeData.agent?.metadata) {
|
||||
Object.assign(answers, { metadata: customizeData.agent.metadata });
|
||||
const filteredMetadata = filterCustomizationData(customizeData.agent.metadata);
|
||||
if (Object.keys(filteredMetadata).length > 0) {
|
||||
Object.assign(answers, { metadata: filteredMetadata });
|
||||
}
|
||||
}
|
||||
if (customizeData.critical_actions) {
|
||||
if (customizeData.critical_actions && customizeData.critical_actions.length > 0) {
|
||||
answers.critical_actions = customizeData.critical_actions;
|
||||
}
|
||||
if (customizeData.memories) {
|
||||
if (customizeData.memories && customizeData.memories.length > 0) {
|
||||
answers.memories = customizeData.memories;
|
||||
}
|
||||
|
||||
@@ -2153,8 +2156,8 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
let manifest = null;
|
||||
if (await fs.pathExists(manifestPath)) {
|
||||
const manifestContent = await fs.readFile(manifestPath, 'utf8');
|
||||
const yaml = require('js-yaml');
|
||||
manifest = yaml.load(manifestContent);
|
||||
const yaml = require('yaml');
|
||||
manifest = yaml.parse(manifestContent);
|
||||
installedModules = manifest.modules || [];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const path = require('node:path');
|
||||
const fs = require('fs-extra');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
const crypto = require('node:crypto');
|
||||
const { getSourcePath, getModulePath } = require('../../../lib/project-root');
|
||||
|
||||
@@ -480,10 +480,9 @@ class ManifestGenerator {
|
||||
ides: this.selectedIdes,
|
||||
};
|
||||
|
||||
const yamlStr = yaml.dump(manifest, {
|
||||
const yamlStr = yaml.stringify(manifest, {
|
||||
indent: 2,
|
||||
lineWidth: -1,
|
||||
noRefs: true,
|
||||
lineWidth: 0,
|
||||
sortKeys: false,
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class Manifest {
|
||||
*/
|
||||
async create(bmadDir, data, installedFiles = []) {
|
||||
const manifestPath = path.join(bmadDir, '_cfg', 'manifest.yaml');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
|
||||
// Ensure _cfg directory exists
|
||||
await fs.ensureDir(path.dirname(manifestPath));
|
||||
@@ -28,10 +28,9 @@ class Manifest {
|
||||
};
|
||||
|
||||
// Write YAML manifest
|
||||
const yamlContent = yaml.dump(manifestData, {
|
||||
const yamlContent = yaml.stringify(manifestData, {
|
||||
indent: 2,
|
||||
lineWidth: -1,
|
||||
noRefs: true,
|
||||
lineWidth: 0,
|
||||
sortKeys: false,
|
||||
});
|
||||
|
||||
@@ -48,12 +47,12 @@ class Manifest {
|
||||
*/
|
||||
async read(bmadDir) {
|
||||
const yamlPath = path.join(bmadDir, '_cfg', 'manifest.yaml');
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
|
||||
if (await fs.pathExists(yamlPath)) {
|
||||
try {
|
||||
const content = await fs.readFile(yamlPath, 'utf8');
|
||||
const manifestData = yaml.load(content);
|
||||
const manifestData = yaml.parse(content);
|
||||
|
||||
// Flatten the structure for compatibility with existing code
|
||||
return {
|
||||
@@ -79,7 +78,7 @@ class Manifest {
|
||||
* @param {Array} installedFiles - Updated list of installed files
|
||||
*/
|
||||
async update(bmadDir, updates, installedFiles = null) {
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
const manifest = (await this.read(bmadDir)) || {};
|
||||
|
||||
// Merge updates
|
||||
@@ -101,10 +100,9 @@ class Manifest {
|
||||
const manifestPath = path.join(bmadDir, '_cfg', 'manifest.yaml');
|
||||
await fs.ensureDir(path.dirname(manifestPath));
|
||||
|
||||
const yamlContent = yaml.dump(manifestData, {
|
||||
const yamlContent = yaml.stringify(manifestData, {
|
||||
indent: 2,
|
||||
lineWidth: -1,
|
||||
noRefs: true,
|
||||
lineWidth: 0,
|
||||
sortKeys: false,
|
||||
});
|
||||
|
||||
@@ -526,9 +524,9 @@ class Manifest {
|
||||
|
||||
try {
|
||||
if (await fs.pathExists(configPath)) {
|
||||
const yaml = require('js-yaml');
|
||||
const yaml = require('yaml');
|
||||
const content = await fs.readFile(configPath, 'utf8');
|
||||
configs[moduleName] = yaml.load(content);
|
||||
configs[moduleName] = yaml.parse(content);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`Could not load config for module ${moduleName}:`, error.message);
|
||||
|
||||
Reference in New Issue
Block a user