fix: harden install XML guard and remove no-op placeholder replacement
This commit is contained in:
parent
76df097957
commit
0b3023cdf5
|
|
@ -32,8 +32,9 @@ let failed = 0;
|
|||
/**
|
||||
* Recursively collect files from a mix of files/directories.
|
||||
*/
|
||||
async function collectFiles(targets, allowedExtensions) {
|
||||
async function collectFiles(targets, allowedExtensions, excludedFiles = new Set()) {
|
||||
const files = [];
|
||||
const normalizedExcludes = new Set([...excludedFiles].map((p) => path.resolve(p)));
|
||||
|
||||
const walk = async (targetPath) => {
|
||||
if (!(await fs.pathExists(targetPath))) {
|
||||
|
|
@ -42,6 +43,10 @@ async function collectFiles(targets, allowedExtensions) {
|
|||
|
||||
const stat = await fs.stat(targetPath);
|
||||
if (stat.isFile()) {
|
||||
const normalizedTargetPath = path.resolve(targetPath);
|
||||
if (normalizedExcludes.has(normalizedTargetPath)) {
|
||||
return;
|
||||
}
|
||||
if (allowedExtensions.has(path.extname(targetPath))) {
|
||||
files.push(targetPath);
|
||||
}
|
||||
|
|
@ -58,6 +63,9 @@ async function collectFiles(targets, allowedExtensions) {
|
|||
await walk(fullPath);
|
||||
continue;
|
||||
}
|
||||
if (normalizedExcludes.has(path.resolve(fullPath))) {
|
||||
continue;
|
||||
}
|
||||
if (allowedExtensions.has(path.extname(entry.name))) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
|
|
@ -273,9 +281,10 @@ async function runTests() {
|
|||
];
|
||||
const allowedExtensions = new Set(['.md', '.yaml', '.yml', '.xml']);
|
||||
const forbiddenRef = 'validate-workflow.xml';
|
||||
const excludedFile = path.join(projectRoot, 'src', 'core', 'tasks', 'validate-workflow.xml');
|
||||
const offenders = [];
|
||||
|
||||
const files = await collectFiles(searchTargets, allowedExtensions);
|
||||
const files = await collectFiles(searchTargets, allowedExtensions, new Set([excludedFile]));
|
||||
for (const fullPath of files) {
|
||||
const content = await fs.readFile(fullPath, 'utf8');
|
||||
if (content.includes(forbiddenRef)) {
|
||||
|
|
|
|||
|
|
@ -80,8 +80,7 @@ class AgentCommandGenerator {
|
|||
.replaceAll('{{module}}', agent.module)
|
||||
.replaceAll('{{path}}', agentPathInModule)
|
||||
.replaceAll('{{description}}', agent.description || `${agent.name} agent`)
|
||||
.replaceAll('_bmad', this.bmadFolderName)
|
||||
.replaceAll('_bmad', '_bmad');
|
||||
.replaceAll('_bmad', this.bmadFolderName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue