From 47478bfaaeff695e1c38609606d9feb949094918 Mon Sep 17 00:00:00 2001 From: yoav0gal Date: Fri, 5 Sep 2025 16:20:06 +0300 Subject: [PATCH] improvements and changes post review --- tools/installer/config/install.config.yaml | 4 +- tools/installer/lib/ide-setup.js | 53 ++++++++++------------ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/tools/installer/config/install.config.yaml b/tools/installer/config/install.config.yaml index be364739..6c4611c7 100644 --- a/tools/installer/config/install.config.yaml +++ b/tools/installer/config/install.config.yaml @@ -78,14 +78,14 @@ ide-configurations: # 4. Rules are stored in .clinerules/ directory in your project gemini: name: Gemini CLI - rule-dir: .gemini/extensions/bmad/ + rule-dir: .gemini/commands/bmad/ format: multi-file command-suffix: .toml instructions: | # To use BMad agents with the Gemini CLI: # 1. The installer creates a `bmad` extension in `.gemini/extensions/`. # 2. This adds custom commands for each agent and task. - # 3. Type /agents: (e.g., "/agents:dev", "/agents:pm") or /tasks: (e.g., "/tasks:create-doc"). + # 3. Type /bmad:agents: (e.g., "/bmad:agents:dev", "/bmad:agents:pm") or /bmad:tasks: (e.g., "/bmad:tasks:create-doc"). # 4. The agent will adopt that persona for the conversation or preform the task. github-copilot: name: Github Copilot diff --git a/tools/installer/lib/ide-setup.js b/tools/installer/lib/ide-setup.js index c47a2145..432c2028 100644 --- a/tools/installer/lib/ide-setup.js +++ b/tools/installer/lib/ide-setup.js @@ -1210,16 +1210,15 @@ class IdeSetup extends BaseIdeSetup { async setupGeminiCli(installDir, selectedAgent) { const ideConfig = await configLoader.getIdeConfiguration('gemini'); - const extensionDir = path.join(installDir, ideConfig['rule-dir']); - const baseCommandsDir = path.join(extensionDir, 'commands'); + const bmadCommandsDir = path.join(installDir, ideConfig['rule-dir']); - const agentCommandsDir = path.join(baseCommandsDir, 'agents'); - const taskCommandsDir = path.join(baseCommandsDir, 'tasks'); + const agentCommandsDir = path.join(bmadCommandsDir, 'agents'); + const taskCommandsDir = path.join(bmadCommandsDir, 'tasks'); await fileManager.ensureDirectory(agentCommandsDir); await fileManager.ensureDirectory(taskCommandsDir); // Create gemini-extension.json manifest - const manifestPath = path.join(extensionDir, 'gemini-extension.json'); + const manifestPath = path.join(bmadCommandsDir, 'gemini-extension.json'); const manifestContent = { name: 'bmad', version: '1.0.0', @@ -1237,21 +1236,20 @@ class IdeSetup extends BaseIdeSetup { continue; } - const agentContent = await fileManager.readFile(agentPath); const agentTitle = await this.getAgentTitle(agentId, installDir); - const commandPath = path.join(agentCommandsDir, `${agentId}${ideConfig['command-suffix']}`); - const escapedAgentContent = agentContent.replaceAll("'''", String.raw`\'\'\'`); - const tomlContent = ` -description = "Activates the ${agentTitle} agent from the BMad Method." + const commandPath = path.join(agentCommandsDir, `${agentId}.toml`); + + // Get relative path from installDir to agent file for @{file} reference + const relativeAgentPath = path.relative(installDir, agentPath).replaceAll('\\', '/'); + + const tomlContent = `description = "Activates the ${agentTitle} agent from the BMad Method." prompt = """ CRITICAL: You are now the BMad '${agentTitle}' agent. Adopt its persona, follow its instructions, and use its capabilities. The full agent definition is below. ---- -${escapedAgentContent} ---- -""" -`; - await fileManager.writeFile(commandPath, tomlContent.trim()); +@{${relativeAgentPath}} +"""`; + + await fileManager.writeFile(commandPath, tomlContent); console.log(chalk.green(`✓ Created agent command: /bmad:agents:${agentId}`)); } @@ -1264,30 +1262,29 @@ ${escapedAgentContent} continue; } - const taskContent = await fileManager.readFile(taskPath); const taskTitle = taskId .split('-') .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) .join(' '); - const commandPath = path.join(taskCommandsDir, `${taskId}${ideConfig['command-suffix']}`); - const escapedTaskContent = taskContent.replaceAll("'''", String.raw`\'\'\'`); - const tomlContent = ` -description = "Executes the BMad Task: ${taskTitle}" + const commandPath = path.join(taskCommandsDir, `${taskId}.toml`); + + // Get relative path from installDir to task file for @{file} reference + const relativeTaskPath = path.relative(installDir, taskPath).replaceAll('\\', '/'); + + const tomlContent = `description = "Executes the BMad Task: ${taskTitle}" prompt = """ CRITICAL: You are to execute the BMad Task defined below. ---- -${escapedTaskContent} ---- -""" -`; - await fileManager.writeFile(commandPath, tomlContent.trim()); +@{${relativeTaskPath}} +"""`; + + await fileManager.writeFile(commandPath, tomlContent); console.log(chalk.green(`✓ Created task command: /bmad:tasks:${taskId}`)); } console.log( chalk.green(` -✓ Created Gemini CLI extension in ${extensionDir}`), +✓ Created Gemini CLI extension in ${bmadCommandsDir}`), ); console.log( chalk.dim('You can now use commands like /bmad:agents:dev or /bmad:tasks:create-doc.'),