improvements and changes post review
This commit is contained in:
parent
4b8acff6a1
commit
47478bfaae
|
|
@ -78,14 +78,14 @@ ide-configurations:
|
||||||
# 4. Rules are stored in .clinerules/ directory in your project
|
# 4. Rules are stored in .clinerules/ directory in your project
|
||||||
gemini:
|
gemini:
|
||||||
name: Gemini CLI
|
name: Gemini CLI
|
||||||
rule-dir: .gemini/extensions/bmad/
|
rule-dir: .gemini/commands/bmad/
|
||||||
format: multi-file
|
format: multi-file
|
||||||
command-suffix: .toml
|
command-suffix: .toml
|
||||||
instructions: |
|
instructions: |
|
||||||
# To use BMad agents with the Gemini CLI:
|
# To use BMad agents with the Gemini CLI:
|
||||||
# 1. The installer creates a `bmad` extension in `.gemini/extensions/`.
|
# 1. The installer creates a `bmad` extension in `.gemini/extensions/`.
|
||||||
# 2. This adds custom commands for each agent and task.
|
# 2. This adds custom commands for each agent and task.
|
||||||
# 3. Type /agents:<agent-name> (e.g., "/agents:dev", "/agents:pm") or /tasks:<task-name> (e.g., "/tasks:create-doc").
|
# 3. Type /bmad:agents:<agent-name> (e.g., "/bmad:agents:dev", "/bmad:agents:pm") or /bmad:tasks:<task-name> (e.g., "/bmad:tasks:create-doc").
|
||||||
# 4. The agent will adopt that persona for the conversation or preform the task.
|
# 4. The agent will adopt that persona for the conversation or preform the task.
|
||||||
github-copilot:
|
github-copilot:
|
||||||
name: Github Copilot
|
name: Github Copilot
|
||||||
|
|
|
||||||
|
|
@ -1210,16 +1210,15 @@ class IdeSetup extends BaseIdeSetup {
|
||||||
|
|
||||||
async setupGeminiCli(installDir, selectedAgent) {
|
async setupGeminiCli(installDir, selectedAgent) {
|
||||||
const ideConfig = await configLoader.getIdeConfiguration('gemini');
|
const ideConfig = await configLoader.getIdeConfiguration('gemini');
|
||||||
const extensionDir = path.join(installDir, ideConfig['rule-dir']);
|
const bmadCommandsDir = path.join(installDir, ideConfig['rule-dir']);
|
||||||
const baseCommandsDir = path.join(extensionDir, 'commands');
|
|
||||||
|
|
||||||
const agentCommandsDir = path.join(baseCommandsDir, 'agents');
|
const agentCommandsDir = path.join(bmadCommandsDir, 'agents');
|
||||||
const taskCommandsDir = path.join(baseCommandsDir, 'tasks');
|
const taskCommandsDir = path.join(bmadCommandsDir, 'tasks');
|
||||||
await fileManager.ensureDirectory(agentCommandsDir);
|
await fileManager.ensureDirectory(agentCommandsDir);
|
||||||
await fileManager.ensureDirectory(taskCommandsDir);
|
await fileManager.ensureDirectory(taskCommandsDir);
|
||||||
|
|
||||||
// Create gemini-extension.json manifest
|
// Create gemini-extension.json manifest
|
||||||
const manifestPath = path.join(extensionDir, 'gemini-extension.json');
|
const manifestPath = path.join(bmadCommandsDir, 'gemini-extension.json');
|
||||||
const manifestContent = {
|
const manifestContent = {
|
||||||
name: 'bmad',
|
name: 'bmad',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
|
|
@ -1237,21 +1236,20 @@ class IdeSetup extends BaseIdeSetup {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const agentContent = await fileManager.readFile(agentPath);
|
|
||||||
const agentTitle = await this.getAgentTitle(agentId, installDir);
|
const agentTitle = await this.getAgentTitle(agentId, installDir);
|
||||||
const commandPath = path.join(agentCommandsDir, `${agentId}${ideConfig['command-suffix']}`);
|
const commandPath = path.join(agentCommandsDir, `${agentId}.toml`);
|
||||||
const escapedAgentContent = agentContent.replaceAll("'''", String.raw`\'\'\'`);
|
|
||||||
const tomlContent = `
|
// Get relative path from installDir to agent file for @{file} reference
|
||||||
description = "Activates the ${agentTitle} agent from the BMad Method."
|
const relativeAgentPath = path.relative(installDir, agentPath).replaceAll('\\', '/');
|
||||||
|
|
||||||
|
const tomlContent = `description = "Activates the ${agentTitle} agent from the BMad Method."
|
||||||
prompt = """
|
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.
|
CRITICAL: You are now the BMad '${agentTitle}' agent. Adopt its persona, follow its instructions, and use its capabilities. The full agent definition is below.
|
||||||
|
|
||||||
---
|
@{${relativeAgentPath}}
|
||||||
${escapedAgentContent}
|
"""`;
|
||||||
---
|
|
||||||
"""
|
await fileManager.writeFile(commandPath, tomlContent);
|
||||||
`;
|
|
||||||
await fileManager.writeFile(commandPath, tomlContent.trim());
|
|
||||||
console.log(chalk.green(`✓ Created agent command: /bmad:agents:${agentId}`));
|
console.log(chalk.green(`✓ Created agent command: /bmad:agents:${agentId}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1264,30 +1262,29 @@ ${escapedAgentContent}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskContent = await fileManager.readFile(taskPath);
|
|
||||||
const taskTitle = taskId
|
const taskTitle = taskId
|
||||||
.split('-')
|
.split('-')
|
||||||
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
||||||
.join(' ');
|
.join(' ');
|
||||||
const commandPath = path.join(taskCommandsDir, `${taskId}${ideConfig['command-suffix']}`);
|
const commandPath = path.join(taskCommandsDir, `${taskId}.toml`);
|
||||||
const escapedTaskContent = taskContent.replaceAll("'''", String.raw`\'\'\'`);
|
|
||||||
const tomlContent = `
|
// Get relative path from installDir to task file for @{file} reference
|
||||||
description = "Executes the BMad Task: ${taskTitle}"
|
const relativeTaskPath = path.relative(installDir, taskPath).replaceAll('\\', '/');
|
||||||
|
|
||||||
|
const tomlContent = `description = "Executes the BMad Task: ${taskTitle}"
|
||||||
prompt = """
|
prompt = """
|
||||||
CRITICAL: You are to execute the BMad Task defined below.
|
CRITICAL: You are to execute the BMad Task defined below.
|
||||||
|
|
||||||
---
|
@{${relativeTaskPath}}
|
||||||
${escapedTaskContent}
|
"""`;
|
||||||
---
|
|
||||||
"""
|
await fileManager.writeFile(commandPath, tomlContent);
|
||||||
`;
|
|
||||||
await fileManager.writeFile(commandPath, tomlContent.trim());
|
|
||||||
console.log(chalk.green(`✓ Created task command: /bmad:tasks:${taskId}`));
|
console.log(chalk.green(`✓ Created task command: /bmad:tasks:${taskId}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
chalk.green(`
|
chalk.green(`
|
||||||
✓ Created Gemini CLI extension in ${extensionDir}`),
|
✓ Created Gemini CLI extension in ${bmadCommandsDir}`),
|
||||||
);
|
);
|
||||||
console.log(
|
console.log(
|
||||||
chalk.dim('You can now use commands like /bmad:agents:dev or /bmad:tasks:create-doc.'),
|
chalk.dim('You can now use commands like /bmad:agents:dev or /bmad:tasks:create-doc.'),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue