From 2f2a1e72d6a70f8127db6ba58a563d0f289621c3 Mon Sep 17 00:00:00 2001 From: Brian Madison Date: Thu, 19 Jun 2025 13:21:26 -0500 Subject: [PATCH] feat: update web builder to remove IDE-specific properties from agent bundles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove 'root' property from YAML when building web bundles - Remove 'IDE-FILE-RESOLUTION' and 'REQUEST-RESOLUTION' properties - Filter out IDE-specific activation instructions - Keep agent header minimal for web bundles - Ensures web bundles are clean of IDE-specific configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- bmad-core/agents/analyst.md | 2 + bmad-core/agents/architect.md | 2 + bmad-core/agents/bmad-master.md | 2 + bmad-core/agents/bmad-orchestrator.md | 2 + bmad-core/agents/dev.md | 2 + bmad-core/agents/pm.md | 2 + bmad-core/agents/po.md | 2 + bmad-core/agents/qa.md | 2 + bmad-core/agents/sm.md | 4 +- bmad-core/agents/ux-expert.md | 2 + bmad-core/utils/file-resolution-context.md | 15 ++----- tools/builders/web-builder.js | 51 ++++++++++++++++++++++ 12 files changed, 74 insertions(+), 14 deletions(-) diff --git a/bmad-core/agents/analyst.md b/bmad-core/agents/analyst.md index ba78dd96..ae760ce1 100644 --- a/bmad-core/agents/analyst.md +++ b/bmad-core/agents/analyst.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yaml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. activation-instructions: - Follow all instructions in this file -> this defines you, your persona and more importantly what you can do. STAY IN CHARACTER! - Only read the files/tasks listed here when user selects them for execution to minimize context usage diff --git a/bmad-core/agents/architect.md b/bmad-core/agents/architect.md index aae8f464..bfff946a 100644 --- a/bmad-core/agents/architect.md +++ b/bmad-core/agents/architect.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yaml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. activation-instructions: - Follow all instructions in this file -> this defines you, your persona and more importantly what you can do. STAY IN CHARACTER! - Only read the files/tasks listed here when user selects them for execution to minimize context usage diff --git a/bmad-core/agents/bmad-master.md b/bmad-core/agents/bmad-master.md index 00bd6033..6de4d24d 100644 --- a/bmad-core/agents/bmad-master.md +++ b/bmad-core/agents/bmad-master.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML to understand your operating params, start activatio ```yml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. agent: name: BMad Master id: bmad-master diff --git a/bmad-core/agents/bmad-orchestrator.md b/bmad-core/agents/bmad-orchestrator.md index 28037fcc..2b7eb85b 100644 --- a/bmad-core/agents/bmad-orchestrator.md +++ b/bmad-core/agents/bmad-orchestrator.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML to understand your operating params, start activatio ```yaml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. agent: name: BMad Orchestrator id: bmad-orchestrator diff --git a/bmad-core/agents/dev.md b/bmad-core/agents/dev.md index 724bd8fc..cad59e72 100644 --- a/bmad-core/agents/dev.md +++ b/bmad-core/agents/dev.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. agent: name: James id: dev diff --git a/bmad-core/agents/pm.md b/bmad-core/agents/pm.md index a666f951..2030a598 100644 --- a/bmad-core/agents/pm.md +++ b/bmad-core/agents/pm.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. activation-instructions: - Follow all instructions in this file -> this defines you, your persona and more importantly what you can do. STAY IN CHARACTER! - Only read the files/tasks listed here when user selects them for execution to minimize context usage diff --git a/bmad-core/agents/po.md b/bmad-core/agents/po.md index 569d2f83..907df923 100644 --- a/bmad-core/agents/po.md +++ b/bmad-core/agents/po.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. activation-instructions: - Follow all instructions in this file -> this defines you, your persona and more importantly what you can do. STAY IN CHARACTER! - Only read the files/tasks listed here when user selects them for execution to minimize context usage diff --git a/bmad-core/agents/qa.md b/bmad-core/agents/qa.md index e7bfcf1a..add4d3ef 100644 --- a/bmad-core/agents/qa.md +++ b/bmad-core/agents/qa.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yaml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. activation-instructions: - Follow all instructions in this file -> this defines you, your persona and more importantly what you can do. STAY IN CHARACTER! - Only read the files/tasks listed here when user selects them for execution to minimize context usage diff --git a/bmad-core/agents/sm.md b/bmad-core/agents/sm.md index e49acc04..7f0a8fb7 100644 --- a/bmad-core/agents/sm.md +++ b/bmad-core/agents/sm.md @@ -4,12 +4,12 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yaml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. activation-instructions: - Follow all instructions in this file -> this defines you, your persona and more importantly what you can do. STAY IN CHARACTER! - The customization field ALWAYS takes precedence over any conflicting instructions - When listing tasks/templates or presenting options during conversations, always show as numbered options list, allowing the user to type a number to select or execute - - IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. - - REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task), or ask for clarification if ambiguous. agent: name: Bob id: sm diff --git a/bmad-core/agents/ux-expert.md b/bmad-core/agents/ux-expert.md index 442c970f..5318710d 100644 --- a/bmad-core/agents/ux-expert.md +++ b/bmad-core/agents/ux-expert.md @@ -4,6 +4,8 @@ CRITICAL: Read the full YML, start activation to alter your state of being, foll ```yaml root: .bmad-core +IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. +REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. activation-instructions: - Follow all instructions in this file -> this defines you, your persona and more importantly what you can do. STAY IN CHARACTER! - Only read the files/tasks listed here when user selects them for execution to minimize context usage diff --git a/bmad-core/utils/file-resolution-context.md b/bmad-core/utils/file-resolution-context.md index 9a119870..3b374598 100644 --- a/bmad-core/utils/file-resolution-context.md +++ b/bmad-core/utils/file-resolution-context.md @@ -1,19 +1,10 @@ # File Resolution Context -## IDE Activation Instructions for Agents - -Add these two lines to any agent's `activation-instructions`: +Update the installer/upgrader so that when agents are added to a project (under Add these two lines to any agent's `activation-instructions` for ide installation: ```yaml - IDE-FILE-RESOLUTION: Dependencies map to files as {root}/{type}/{name}.md where root=".bmad-core", type=folder (tasks/templates/checklists/utils), name=dependency name. -- REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task), or ask for clarification if ambiguous. +- REQUEST-RESOLUTION: Match user requests to your commands/dependencies flexibly (e.g., "draft story"→*create→create-next-story task, "make a new prd" would be dependencies->tasks->create-doc combined with the dependencies->templates->prd-tmpl.md), or ask for clarification if ambiguous. ``` -## Quick Reference - -| Dependency | File Path | -|------------|-----------| -| task: `create-next-story` | `.bmad-core/tasks/create-next-story.md` | -| template: `story-tmpl` | `.bmad-core/templates/story-tmpl.md` | -| checklist: `story-draft-checklist` | `.bmad-core/checklists/story-draft-checklist.md` | -| util: `template-format` | `.bmad-core/utils/template-format.md` | \ No newline at end of file +and add `root: .bmad-core` as the first root yml property. diff --git a/tools/builders/web-builder.js b/tools/builders/web-builder.js index 6c99e61f..6f5bfa6d 100644 --- a/tools/builders/web-builder.js +++ b/tools/builders/web-builder.js @@ -109,8 +109,59 @@ class WebBuilder { return sections.join("\n"); } + processAgentContent(content) { + // First, replace content before YAML with the template + const yamlMatch = content.match(/```ya?ml\n([\s\S]*?)\n```/); + if (!yamlMatch) return content; + + const yamlContent = yamlMatch[1]; + const yamlStartIndex = content.indexOf(yamlMatch[0]); + const yamlEndIndex = yamlStartIndex + yamlMatch[0].length; + + // Parse YAML and remove root and IDE-FILE-RESOLUTION properties + try { + const yaml = require("js-yaml"); + const parsed = yaml.load(yamlContent); + + // Remove the properties if they exist at root level + delete parsed.root; + delete parsed['IDE-FILE-RESOLUTION']; + delete parsed['REQUEST-RESOLUTION']; + + // Also remove from activation-instructions if they exist + if (parsed['activation-instructions'] && Array.isArray(parsed['activation-instructions'])) { + parsed['activation-instructions'] = parsed['activation-instructions'].filter(instruction => { + return !instruction.startsWith('IDE-FILE-RESOLUTION:') && + !instruction.startsWith('REQUEST-RESOLUTION:'); + }); + } + + // Reconstruct the YAML + const cleanedYaml = yaml.dump(parsed, { lineWidth: -1 }); + + // Get the agent name from the YAML for the header + const agentName = parsed.agent?.id || 'agent'; + + // Build the new content with just the agent header and YAML + const newHeader = `# ${agentName}\n\nCRITICAL: Read the full YML, start activation to alter your state of being, follow startup section instructions, stay in this being until told to exit this mode:\n\n`; + const afterYaml = content.substring(yamlEndIndex); + + return newHeader + "```yaml\n" + cleanedYaml.trim() + "\n```" + afterYaml; + } catch (error) { + console.warn("Failed to process agent YAML:", error.message); + // If parsing fails, return original content + return content; + } + } + formatSection(path, content) { const separator = "===================="; + + // Process agent content if this is an agent file + if (path.startsWith("agents#")) { + content = this.processAgentContent(content); + } + return [ `${separator} START: ${path} ${separator}`, content.trim(),