mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-18 02:05:30 +00:00
fix: Remove menu items for workflows with web_bundle: false
Enhanced removeSkippedWorkflowCommands() to properly remove all menu item formats that reference workflows with web_bundle: false: 1. <item> tags with workflow attribute 2. <item> tags with run-workflow attribute 3. <c> tags with run-workflow attribute (legacy) This ensures that workflows not designed for web bundles (like workflow-status which requires filesystem access) are completely excluded from web bundles, including their menu items. Verified: - workflow-status menu item removed from SM agent - workflow-status YAML not included in bundle dependencies
This commit is contained in:
parent
9a37cbb7fc
commit
80a04bfce3
@ -697,16 +697,25 @@ class WebBundler {
|
|||||||
removeSkippedWorkflowCommands(agentXml, skippedWorkflows) {
|
removeSkippedWorkflowCommands(agentXml, skippedWorkflows) {
|
||||||
let modifiedXml = agentXml;
|
let modifiedXml = agentXml;
|
||||||
|
|
||||||
// For each skipped workflow, find and remove the corresponding <c> command
|
// For each skipped workflow, find and remove menu items and commands
|
||||||
for (const workflowPath of skippedWorkflows) {
|
for (const workflowPath of skippedWorkflows) {
|
||||||
// Match: <c cmd="..." run-workflow="workflowPath">...</c>
|
|
||||||
// Need to escape special regex characters in the path
|
// Need to escape special regex characters in the path
|
||||||
const escapedPath = workflowPath.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
const escapedPath = workflowPath.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
||||||
|
|
||||||
// Pattern to match the command line with this workflow
|
// Pattern 1: Remove <item> tags with workflow attribute
|
||||||
const pattern = new RegExp(`\\s*<c\\s+cmd="[^"]*"\\s+run-workflow="[^"]*${escapedPath}"[^>]*>.*?</c>\\s*`, 'gs');
|
// Match: <item cmd="..." workflow="workflowPath">...</item>
|
||||||
|
const itemWorkflowPattern = new RegExp(`\\s*<item\\s+[^>]*workflow="[^"]*${escapedPath}"[^>]*>.*?</item>\\s*`, 'gs');
|
||||||
|
modifiedXml = modifiedXml.replace(itemWorkflowPattern, '');
|
||||||
|
|
||||||
modifiedXml = modifiedXml.replace(pattern, '');
|
// Pattern 2: Remove <item> tags with run-workflow attribute
|
||||||
|
// Match: <item cmd="..." run-workflow="workflowPath">...</item>
|
||||||
|
const itemRunWorkflowPattern = new RegExp(`\\s*<item\\s+[^>]*run-workflow="[^"]*${escapedPath}"[^>]*>.*?</item>\\s*`, 'gs');
|
||||||
|
modifiedXml = modifiedXml.replace(itemRunWorkflowPattern, '');
|
||||||
|
|
||||||
|
// Pattern 3: Remove <c> tags with run-workflow attribute (legacy)
|
||||||
|
// Match: <c cmd="..." run-workflow="workflowPath">...</c>
|
||||||
|
const cPattern = new RegExp(`\\s*<c\\s+[^>]*run-workflow="[^"]*${escapedPath}"[^>]*>.*?</c>\\s*`, 'gs');
|
||||||
|
modifiedXml = modifiedXml.replace(cPattern, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifiedXml;
|
return modifiedXml;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user