diff --git a/package.json b/package.json index c16882c9..f264dddb 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "version:expansion:all:patch": "node tools/bump-all-versions.js patch", "release": "semantic-release", "release:test": "semantic-release --dry-run --no-ci || echo 'Config test complete - authentication errors are expected locally'", + "prepare": "husky" }, "dependencies": { diff --git a/tools/installer/config/ide-agent-config.yaml b/tools/installer/config/ide-agent-config.yaml index c4fa7d0f..404ab46c 100644 --- a/tools/installer/config/ide-agent-config.yaml +++ b/tools/installer/config/ide-agent-config.yaml @@ -39,6 +39,28 @@ roo-permissions: # Lower numbers appear first in the list # Agents not listed get order 99 cline-order: + # Core agents + bmad-master: 1 + bmad-orchestrator: 2 + pm: 3 + analyst: 4 + architect: 5 + po: 6 + sm: 7 + dev: 8 + qa: 9 + ux-expert: 10 + # Expansion pack agents + bmad-the-creator: 11 + game-designer: 12 + game-developer: 13 + game-sm: 14 + infra-devops-platform: 15 + +# Zed agent ordering (reuses cline ordering for consistency) +# Lower numbers appear first in the list +# Agents not listed get order 99 +zed-order: # Core agents bmad-master: 1 bmad-orchestrator: 2 diff --git a/tools/installer/config/install.config.yaml b/tools/installer/config/install.config.yaml index a170ade8..244c5e13 100644 --- a/tools/installer/config/install.config.yaml +++ b/tools/installer/config/install.config.yaml @@ -66,6 +66,17 @@ ide-configurations: # 2. Type @agent-name (e.g., "@dev", "@pm", "@architect") # 3. The agent will adopt that persona for the conversation # 4. Rules are stored in .clinerules/ directory in your project + zed: + name: Zed + rule-dir: .zed/assistants/ + format: multi-file + command-suffix: .md + instructions: | + # To use BMad agents in Zed: + # 1. Open the AI assistant panel (Cmd+I on Mac, Ctrl+I on Windows/Linux) + # 2. Type @agent-name (e.g., "@dev", "@pm", "@architect") + # 3. The agent will adopt that persona for the conversation + # 4. Assistants are stored in .zed/assistants/ directory in your project gemini: name: Gemini CLI rule-dir: .gemini/bmad-method/ diff --git a/tools/installer/config/zed-config.json b/tools/installer/config/zed-config.json new file mode 100644 index 00000000..075422c3 --- /dev/null +++ b/tools/installer/config/zed-config.json @@ -0,0 +1,41 @@ +{ + "assistants": { + "bmad-method": { + "description": "BMad Method AI Agent Framework", + "version": "4.31.0", + "assistants_dir": ".zed/assistants", + "usage": { + "activation": "Type @agent-name to activate a specific agent", + "examples": [ + "@dev - Activate the Developer agent", + "@pm - Activate the Product Manager agent", + "@architect - Activate the Architect agent", + "@qa - Activate the QA agent", + "@po - Activate the Product Owner agent", + "@sm - Activate the Scrum Master agent", + "@analyst - Activate the Analyst agent", + "@ux-expert - Activate the UX Expert agent" + ] + }, + "project_integration": { + "documentation": ".bmad-core/", + "templates": ".bmad-core/templates/", + "tasks": ".bmad-core/tasks/", + "checklists": ".bmad-core/checklists/", + "data": ".bmad-core/data/" + }, + "features": { + "file_access": "Full access to project files", + "context_awareness": "Understands project structure and conventions", + "template_system": "Access to BMad document templates", + "task_execution": "Can execute specific BMad tasks", + "quality_assurance": "Access to BMad checklists and validation" + } + } + }, + "setup_instructions": { + "installation": "Run 'npx bmad-method install' and select 'zed' as your IDE", + "activation": "Open Zed AI assistant panel (Cmd+I on Mac, Ctrl+I on Windows/Linux)", + "usage": "Type @agent-name to activate specific BMad agents" + } +} \ No newline at end of file diff --git a/tools/installer/config/zed-readme.md b/tools/installer/config/zed-readme.md new file mode 100644 index 00000000..ec101ffe --- /dev/null +++ b/tools/installer/config/zed-readme.md @@ -0,0 +1,132 @@ +# BMad Method - Zed Integration + +This document explains how to use BMad Method agents within Zed, the fast and modern code editor. + +## Installation + +1. **Install BMad Method in your project:** + ```bash + npx bmad-method install + ``` + +2. **Select Zed as your IDE** when prompted during installation. + +3. **The installer will create:** + - `.zed/assistants/` - Directory containing all BMad agent assistants + - `.zed/bmad-config.json` - Configuration file for Zed integration + - Numbered assistant files (e.g., `01-bmad-master.md`, `02-pm.md`) + +## Usage + +### Activating Agents + +1. **Open Zed AI Assistant Panel:** + - **Mac:** `Cmd+I` + - **Windows/Linux:** `Ctrl+I` + +2. **Activate an agent by typing:** + ``` + @agent-name + ``` + +### Available Agents + +| Agent | Command | Description | +|-------|---------|-------------| +| BMad Master | `@bmad-master` | Master agent that can perform any task | +| Product Manager | `@pm` | Product requirements and planning | +| Analyst | `@analyst` | Market research and analysis | +| Architect | `@architect` | System architecture and design | +| Product Owner | `@po` | Story management and prioritization | +| Scrum Master | `@sm` | Process management and story creation | +| Developer | `@dev` | Code implementation and development | +| QA Engineer | `@qa` | Testing and quality assurance | +| UX Expert | `@ux-expert` | User experience and interface design | + +### Example Interactions + +``` +@dev Create a React component for user authentication +@pm Review the current sprint progress +@architect Design the database schema for the user system +@qa Review the authentication component and suggest tests +``` + +## Features + +### Project Context Awareness +- Agents understand your project structure +- Access to `.bmad-core/` documentation and templates +- Knowledge of project conventions and standards + +### File System Integration +- Full access to read and modify project files +- Can create new files and update existing ones +- Follows project file organization patterns + +### Template System +- Access to BMad document templates +- Can generate PRDs, architecture docs, user stories +- Maintains consistency with BMad methodology + +### Task Execution +- Can execute specific BMad tasks +- Access to quality assurance checklists +- Follows BMad workflows and processes + +## Configuration + +The integration creates several configuration files: + +### `.zed/assistants/` +Contains individual assistant files for each BMad agent, numbered for ordering. + +### `.zed/bmad-config.json` +Configuration file that describes the BMad integration and available features. + +## Troubleshooting + +### Agents Not Appearing +- Ensure you ran `npx bmad-method install` and selected Zed +- Check that `.zed/assistants/` directory exists +- Restart Zed after installation + +### Agent Not Responding +- Verify you're using the correct `@agent-name` syntax +- Check that the agent file exists in `.zed/assistants/` +- Try refreshing the AI assistant panel + +### File Access Issues +- Ensure Zed has permission to access your project directory +- Check that the agent has the necessary file permissions +- Verify project structure matches BMad expectations + +## Advanced Usage + +### Custom Agent Ordering +You can modify the agent ordering by editing the configuration in: +- `tools/installer/config/ide-agent-config.yaml` (before installation) +- `.zed/assistants/` file numbering (after installation) + +### Expansion Packs +If you have BMad expansion packs installed, their agents will also be available: +- Game development agents (if game dev expansion is installed) +- Infrastructure agents (if infrastructure expansion is installed) +- Other domain-specific agents + +### Project-Specific Customization +- Agents automatically load project-specific documentation +- They adapt to your project's coding standards and conventions +- Can reference project-specific templates and checklists + +## Support + +For issues with Zed integration: +1. Check the BMad documentation: `bmad-core/user-guide.md` +2. Review the installation logs for any errors +3. Ensure you're using a compatible version of Zed +4. Join the BMad community for help and support + +--- + +**Note:** This integration is designed to work with Zed's AI assistant system. Make sure you have the latest version of Zed installed for the best experience. \ No newline at end of file diff --git a/tools/installer/lib/ide-setup.js b/tools/installer/lib/ide-setup.js index 5b940f2b..90173cb1 100644 --- a/tools/installer/lib/ide-setup.js +++ b/tools/installer/lib/ide-setup.js @@ -53,6 +53,8 @@ class IdeSetup extends BaseIdeSetup { return this.setupRoo(installDir, selectedAgent); case "cline": return this.setupCline(installDir, selectedAgent); + case "zed": + return this.setupZed(installDir, selectedAgent); case "gemini": return this.setupGeminiCli(installDir, selectedAgent); case "github-copilot": @@ -780,6 +782,85 @@ class IdeSetup extends BaseIdeSetup { return true; } + async setupZed(installDir, selectedAgent) { + const zedAssistantsDir = path.join(installDir, ".zed", "assistants"); + const agents = selectedAgent ? [selectedAgent] : await this.getAllAgentIds(installDir); + + await fileManager.ensureDirectory(zedAssistantsDir); + + // Load dynamic agent ordering from configuration + const config = await this.loadIdeAgentConfig(); + const agentOrder = config['zed-order'] || config['cline-order'] || {}; // Use Zed-specific ordering, fallback to cline + + for (const agentId of agents) { + // Find the agent file + const agentPath = await this.findAgentPath(agentId, installDir); + + if (agentPath) { + const agentContent = await fileManager.readFile(agentPath); + + // Get numeric prefix for ordering + const order = agentOrder[agentId] || 99; + const prefix = order.toString().padStart(2, '0'); + const mdPath = path.join(zedAssistantsDir, `${prefix}-${agentId}.md`); + + // Create MD content for Zed (similar to Cline but optimized for Zed's assistant system) + let mdContent = `# ${await this.getAgentTitle(agentId, installDir)} Assistant\n\n`; + mdContent += `This assistant defines the ${await this.getAgentTitle(agentId, installDir)} persona for Zed AI.\n\n`; + mdContent += "## Assistant Activation\n\n"; + mdContent += + "When the user types `@" + agentId + "` or `@agent-name`, adopt this persona and follow these guidelines:\n\n"; + mdContent += "```yaml\n"; + // Extract just the YAML content from the agent file + const yamlContent = extractYamlFromAgent(agentContent); + if (yamlContent) { + mdContent += yamlContent; + } else { + // If no YAML found, include the whole content minus the header + mdContent += agentContent.replace(/^#.*$/m, "").trim(); + } + mdContent += "\n```\n\n"; + mdContent += "## Project Context\n\n"; + mdContent += `- Maintain consistency with project documentation in .bmad-core/\n`; + mdContent += `- Follow the agent's specific guidelines and constraints\n`; + mdContent += `- Update relevant project files when making changes\n`; + mdContent += `- Work within the project's file structure and conventions\n`; + const relativePath = path.relative(installDir, agentPath).replace(/\\/g, '/'); + mdContent += `- Reference the complete agent definition in [${relativePath}](${relativePath})\n\n`; + mdContent += "## Zed Integration\n\n"; + mdContent += `- Use Zed's file system access to read and modify project files\n`; + mdContent += `- Leverage Zed's AI capabilities for code generation and analysis\n`; + mdContent += `- Follow Zed's coding standards and best practices\n\n`; + mdContent += "## Usage\n\n"; + mdContent += `Type \`@${agentId}\` to activate this ${await this.getAgentTitle(agentId, installDir)} assistant.\n`; + + await fileManager.writeFile(mdPath, mdContent); + console.log(chalk.green(`āœ“ Created assistant: ${prefix}-${agentId}.md`)); + } + } + + // Create Zed configuration file + const zedConfigPath = path.join(installDir, ".zed", "bmad-config.json"); + const zedConfigContent = await fileManager.readFile(path.join(__dirname, '..', 'config', 'zed-config.json')); + await fileManager.writeFile(zedConfigPath, zedConfigContent); + console.log(chalk.green(`āœ“ Created Zed configuration: bmad-config.json`)); + + // Create Zed README file + const zedReadmePath = path.join(installDir, ".zed", "README.md"); + const zedReadmeContent = await fileManager.readFile(path.join(__dirname, '..', 'config', 'zed-readme.md')); + await fileManager.writeFile(zedReadmePath, zedReadmeContent); + console.log(chalk.green(`āœ“ Created Zed README: README.md`)); + + console.log(chalk.green(`\nāœ“ Created Zed assistants in ${zedAssistantsDir}`)); + console.log(chalk.dim("Assistants will be available when you open this project in Zed")); + console.log(chalk.cyan("\nšŸ“‹ Zed Integration Complete!")); + console.log(chalk.dim("• Open Zed AI assistant panel (Cmd+I on Mac, Ctrl+I on Windows/Linux)")); + console.log(chalk.dim("• Type @agent-name to activate BMad agents")); + console.log(chalk.dim("• Example: @dev, @pm, @architect, @qa")); + + return true; + } + async setupGeminiCli(installDir) { const geminiDir = path.join(installDir, ".gemini"); const bmadMethodDir = path.join(geminiDir, "bmad-method");