mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-17 17:55:34 +00:00
agent customization now gets allied on quick update and compile agents
This commit is contained in:
parent
8642553bd7
commit
ac5fa5c23f
@ -1,6 +1,5 @@
|
|||||||
# Agent Customization
|
# Agent Customization
|
||||||
# Customize any section below - all are optional
|
# Customize any section below - all are optional
|
||||||
# After editing: npx bmad-method build <agent-name>
|
|
||||||
|
|
||||||
# Override agent name
|
# Override agent name
|
||||||
agent:
|
agent:
|
||||||
|
|||||||
@ -2798,11 +2798,28 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
|||||||
const relativePath = path.relative(bmadDir, fullPath);
|
const relativePath = path.relative(bmadDir, fullPath);
|
||||||
const fileName = path.basename(fullPath);
|
const fileName = path.basename(fullPath);
|
||||||
|
|
||||||
// Skip _cfg directory EXCEPT for agent customizations
|
// Skip _cfg directory EXCEPT for modified agent customizations
|
||||||
if (
|
if (relativePath.startsWith('_cfg/') || relativePath.startsWith('_cfg\\')) {
|
||||||
(relativePath.startsWith('_cfg/') || relativePath.startsWith('_cfg\\')) && // Allow .customize.yaml files in _cfg/agents/
|
// Special handling for .customize.yaml files - only preserve if modified
|
||||||
!(relativePath.includes('/agents/') && fileName.endsWith('.customize.yaml'))
|
if (relativePath.includes('/agents/') && fileName.endsWith('.customize.yaml')) {
|
||||||
) {
|
// Check if the customization file has been modified from manifest
|
||||||
|
const manifestPath = path.join(bmadDir, '_cfg', 'manifest.yaml');
|
||||||
|
if (await fs.pathExists(manifestPath)) {
|
||||||
|
const crypto = require('node:crypto');
|
||||||
|
const currentContent = await fs.readFile(fullPath, 'utf8');
|
||||||
|
const currentHash = crypto.createHash('sha256').update(currentContent).digest('hex');
|
||||||
|
|
||||||
|
const yaml = require('yaml');
|
||||||
|
const manifestContent = await fs.readFile(manifestPath, 'utf8');
|
||||||
|
const manifestData = yaml.parse(manifestContent);
|
||||||
|
const originalHash = manifestData.agentCustomizations?.[relativePath];
|
||||||
|
|
||||||
|
// Only add to customFiles if hash differs (user modified)
|
||||||
|
if (originalHash && currentHash !== originalHash) {
|
||||||
|
customFiles.push(fullPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2814,7 +2831,11 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
|||||||
|
|
||||||
if (!fileInfo) {
|
if (!fileInfo) {
|
||||||
// File not in manifest = custom file
|
// File not in manifest = custom file
|
||||||
customFiles.push(fullPath);
|
// EXCEPT: Agent .md files in module folders are generated files, not custom
|
||||||
|
// Only treat .md files under _cfg/agents/ as custom
|
||||||
|
if (!(fileName.endsWith('.md') && relativePath.includes('/agents/') && !relativePath.startsWith('_cfg/'))) {
|
||||||
|
customFiles.push(fullPath);
|
||||||
|
}
|
||||||
} else if (manifestHasHashes && fileInfo.hash) {
|
} else if (manifestHasHashes && fileInfo.hash) {
|
||||||
// File in manifest with hash - check if it was modified
|
// File in manifest with hash - check if it was modified
|
||||||
const currentHash = await this.manifest.calculateFileHash(fullPath);
|
const currentHash = await this.manifest.calculateFileHash(fullPath);
|
||||||
|
|||||||
@ -820,6 +820,32 @@ class ModuleManager {
|
|||||||
if (await fs.pathExists(genericTemplatePath)) {
|
if (await fs.pathExists(genericTemplatePath)) {
|
||||||
await this.copyFileWithPlaceholderReplacement(genericTemplatePath, customizePath);
|
await this.copyFileWithPlaceholderReplacement(genericTemplatePath, customizePath);
|
||||||
console.log(chalk.dim(` Created customize: ${moduleName}-${agentName}.customize.yaml`));
|
console.log(chalk.dim(` Created customize: ${moduleName}-${agentName}.customize.yaml`));
|
||||||
|
|
||||||
|
// Store original hash for modification detection
|
||||||
|
const crypto = require('node:crypto');
|
||||||
|
const customizeContent = await fs.readFile(customizePath, 'utf8');
|
||||||
|
const originalHash = crypto.createHash('sha256').update(customizeContent).digest('hex');
|
||||||
|
|
||||||
|
// Store in main manifest
|
||||||
|
const manifestPath = path.join(bmadDir, '_cfg', 'manifest.yaml');
|
||||||
|
let manifestData = {};
|
||||||
|
if (await fs.pathExists(manifestPath)) {
|
||||||
|
const manifestContent = await fs.readFile(manifestPath, 'utf8');
|
||||||
|
const yaml = require('yaml');
|
||||||
|
manifestData = yaml.parse(manifestContent);
|
||||||
|
}
|
||||||
|
if (!manifestData.agentCustomizations) {
|
||||||
|
manifestData.agentCustomizations = {};
|
||||||
|
}
|
||||||
|
manifestData.agentCustomizations[path.relative(bmadDir, customizePath)] = originalHash;
|
||||||
|
|
||||||
|
// Write back to manifest
|
||||||
|
const yaml = require('yaml');
|
||||||
|
const updatedContent = yaml.stringify(manifestData, {
|
||||||
|
indent: 2,
|
||||||
|
lineWidth: 0,
|
||||||
|
});
|
||||||
|
await fs.writeFile(manifestPath, updatedContent, 'utf8');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user