From 80a04bfce3d8967da78aadf4169293d226e37708 Mon Sep 17 00:00:00 2001 From: Brian Madison Date: Wed, 5 Nov 2025 21:33:59 -0600 Subject: [PATCH] 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. tags with workflow attribute 2. tags with run-workflow attribute 3. 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 --- tools/cli/bundlers/web-bundler.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/cli/bundlers/web-bundler.js b/tools/cli/bundlers/web-bundler.js index e1a565d3..730c8987 100644 --- a/tools/cli/bundlers/web-bundler.js +++ b/tools/cli/bundlers/web-bundler.js @@ -697,16 +697,25 @@ class WebBundler { removeSkippedWorkflowCommands(agentXml, skippedWorkflows) { let modifiedXml = agentXml; - // For each skipped workflow, find and remove the corresponding command + // For each skipped workflow, find and remove menu items and commands for (const workflowPath of skippedWorkflows) { - // Match: ... // Need to escape special regex characters in the path const escapedPath = workflowPath.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`); - // Pattern to match the command line with this workflow - const pattern = new RegExp(`\\s*]*>.*?\\s*`, 'gs'); + // Pattern 1: Remove tags with workflow attribute + // Match: ... + const itemWorkflowPattern = new RegExp(`\\s*]*workflow="[^"]*${escapedPath}"[^>]*>.*?\\s*`, 'gs'); + modifiedXml = modifiedXml.replace(itemWorkflowPattern, ''); - modifiedXml = modifiedXml.replace(pattern, ''); + // Pattern 2: Remove tags with run-workflow attribute + // Match: ... + const itemRunWorkflowPattern = new RegExp(`\\s*]*run-workflow="[^"]*${escapedPath}"[^>]*>.*?\\s*`, 'gs'); + modifiedXml = modifiedXml.replace(itemRunWorkflowPattern, ''); + + // Pattern 3: Remove tags with run-workflow attribute (legacy) + // Match: ... + const cPattern = new RegExp(`\\s*]*run-workflow="[^"]*${escapedPath}"[^>]*>.*?\\s*`, 'gs'); + modifiedXml = modifiedXml.replace(cPattern, ''); } return modifiedXml;