diff --git a/tools/cli/installers/lib/ide/github-copilot.js b/tools/cli/installers/lib/ide/github-copilot.js index 033e8d627..5862eb758 100644 --- a/tools/cli/installers/lib/ide/github-copilot.js +++ b/tools/cli/installers/lib/ide/github-copilot.js @@ -248,9 +248,9 @@ You must fully embody this agent's persona and follow all activation instruction */ createWorkflowPromptContent(entry, workflowFile, toolsStr) { const description = this.escapeYamlSingleQuote(this.createPromptDescription(entry.name)); - // bmm/config.yaml is safe to hardcode here: these prompts are only generated when - // bmad-help.csv exists (bmm module data), so bmm is guaranteed to be installed. - const configLine = `1. Load {project-root}/${this.bmadFolderName}/bmm/config.yaml and store ALL fields as session variables`; + // Use the module from the bmad-help.csv entry to reference the correct config.yaml + const configModule = entry.module || 'core'; + const configLine = `1. Load {project-root}/${this.bmadFolderName}/${configModule}/config.yaml and store ALL fields as session variables`; let body; if (workflowFile.endsWith('.yaml')) { @@ -345,14 +345,16 @@ ${body} const safeDescription = this.escapeYamlSingleQuote(cmd.description); const toolsStr = this.getToolsForFile(`${cmd.file}.prompt.md`); + // Use the module from the bmad-help.csv entry to reference the correct paths + const configModule = entry.module || 'core'; const content = `--- description: '${safeDescription}' agent: 'agent' tools: ${toolsStr} --- -1. Load {project-root}/${this.bmadFolderName}/bmm/config.yaml and store ALL fields as session variables -2. Load the full agent file from {project-root}/${this.bmadFolderName}/bmm/agents/tech-writer/tech-writer.md and activate the Paige (Technical Writer) persona +1. Load {project-root}/${this.bmadFolderName}/${configModule}/config.yaml and store ALL fields as session variables +2. Load the full agent file from {project-root}/${this.bmadFolderName}/${configModule}/agents/tech-writer/tech-writer.md and activate the Paige (Technical Writer) persona 3. Execute the ${entry.name} menu command (${cmd.code}) `; @@ -377,15 +379,15 @@ tools: ${toolsStr} const agentPath = artifact.agentPath || artifact.relativePath; const agentFilePath = `{project-root}/${this.bmadFolderName}/${agentPath}`; - // bmm/config.yaml is safe to hardcode: agent activators are only generated from - // bmm agent artifacts, so bmm is guaranteed to be installed. + // Use the agent's module to reference the correct config.yaml + const configModule = artifact.module || 'core'; return `--- description: '${safeDescription}' agent: 'agent' tools: ${toolsStr} --- -1. Load {project-root}/${this.bmadFolderName}/bmm/config.yaml and store ALL fields as session variables +1. Load {project-root}/${this.bmadFolderName}/${configModule}/config.yaml and store ALL fields as session variables 2. Load the full agent file from ${agentFilePath} 3. Follow ALL activation instructions in the agent file 4. Display the welcome/greeting as instructed @@ -403,6 +405,12 @@ tools: ${toolsStr} async generateCopilotInstructions(projectDir, bmadDir, agentManifest, options = {}) { const configVars = await this.loadModuleConfig(bmadDir); + // Determine installed modules (excluding internal directories) + const selectedModules = options.selectedModules || []; + const installedModules = selectedModules.length > 0 ? selectedModules : ['core']; + // Filter to only non-core modules for display (core is always listed separately) + const nonCoreModules = installedModules.filter((m) => m !== 'core'); + // Build the agents table from the manifest let agentsTable = '| Agent | Persona | Title | Capabilities |\n|---|---|---|---|\n'; const agentOrder = [ @@ -428,6 +436,39 @@ tools: ${toolsStr} } const bmad = this.bmadFolderName; + + // Build dynamic module paths based on installed modules + const moduleAgentPaths = nonCoreModules.map((m) => `\`${bmad}/${m}/agents/\``).join(', '); + const moduleWorkflowPaths = nonCoreModules.map((m) => `\`${bmad}/${m}/workflows/\``).join(', '); + const moduleConfigPaths = nonCoreModules.map((m) => `\`${bmad}/${m}/config.yaml\``).join(', '); + + // Build agent definitions line + let agentDefsLine; + if (nonCoreModules.length > 0) { + agentDefsLine = `- **Agent definitions**: ${moduleAgentPaths} and \`${bmad}/core/agents/\` (core)`; + } else { + agentDefsLine = `- **Agent definitions**: \`${bmad}/core/agents/\``; + } + + // Build workflow definitions line + let workflowDefsLine; + if (nonCoreModules.length > 0) { + workflowDefsLine = `- **Workflow definitions**: ${moduleWorkflowPaths} (organized by phase)`; + } else { + workflowDefsLine = `- **Workflow definitions**: \`${bmad}/core/workflows/\``; + } + + // Build module configuration line + let moduleConfigLine; + if (nonCoreModules.length > 0) { + moduleConfigLine = `- **Module configuration**: ${moduleConfigPaths}`; + } else { + moduleConfigLine = `- **Module configuration**: (no non-core modules installed)`; + } + + // Determine primary module for config loading instruction + const primaryModule = nonCoreModules.length > 0 ? nonCoreModules[0] : 'core'; + const bmadSection = `# BMAD Method — Project Instructions ## Project Configuration @@ -444,12 +485,12 @@ tools: ${toolsStr} ## BMAD Runtime Structure -- **Agent definitions**: \`${bmad}/bmm/agents/\` (BMM module) and \`${bmad}/core/agents/\` (core) -- **Workflow definitions**: \`${bmad}/bmm/workflows/\` (organized by phase) +${agentDefsLine} +${workflowDefsLine} - **Core tasks**: \`${bmad}/core/tasks/\` (help, editorial review, indexing, sharding, adversarial review) - **Core workflows**: \`${bmad}/core/workflows/\` (brainstorming, party-mode, advanced-elicitation) - **Workflow engine**: \`${bmad}/core/tasks/workflow.xml\` (executes YAML-based workflows) -- **Module configuration**: \`${bmad}/bmm/config.yaml\` +${moduleConfigLine} - **Core configuration**: \`${bmad}/core/config.yaml\` - **Agent manifest**: \`${bmad}/_config/agent-manifest.csv\` - **Workflow manifest**: \`${bmad}/_config/workflow-manifest.csv\` @@ -458,7 +499,7 @@ tools: ${toolsStr} ## Key Conventions -- Always load \`${bmad}/bmm/config.yaml\` before any agent activation or workflow execution +- Always load the agent/workflow's module \`config.yaml\` before activation or execution (each prompt file specifies which config to load) - Store all config fields as session variables: \`{user_name}\`, \`{communication_language}\`, \`{output_folder}\`, \`{planning_artifacts}\`, \`{implementation_artifacts}\`, \`{project_knowledge}\` - MD-based workflows execute directly — load and follow the \`.md\` file - YAML-based workflows require the workflow engine — load \`workflow.xml\` first, then pass the \`.yaml\` config