feat(opencode): add JSON-only integration and compact AGENTS.md generator (#570)

* feat: add OpenCode integration implementation plan for BMAD-METHOD

* installer(opencode): add OpenCode target metadata in install.config.yaml

* chore(deps): add comment-json for JSONC parsing in OpenCode integration

* feat(installer/opencode): implement setupOpenCode with minimal instructions merge and BMAD-managed agents/commands

* feat(installer): add OpenCode (SST) to IDE selector and CLI --ide help

* fix(opencode): align generated opencode.json(c) with schema (instructions as strings; agent.prompt; command.template; remove unsupported fields)

* feat(installer): enhance OpenCode setup with agent selection and prefix options

* fix: update configuration file references from `bmad-core/core-config.yaml` to `.bmad-core/core-config.yaml` across multiple agent and task files for consistency and clarity.

* refactor: streamline OpenCode configuration prompts and normalize instruction paths for agents and tasks

* feat: add tools property to agent definitions for enhanced functionality. Otherwise opencode consders the subagents as readonly

* feat: add extraction of 'whenToUse'  from agents markdown files for improved agent configuration in opencode

* feat: enhance task purpose extraction from markdown files with improved parsing and cleanup logic

* feat: add collision warnings for non-BMAD-managed agent and command keys during setup

* feat: generate and update AGENTS.md for OpenCode integration with agent and task details

* feat: add compact AGENTS.md generator and JSON-only integration for OpenCode

* chore(docs): remove completed OpenCode integration implementation plans

* feat: enable default prefixes for agent and command keys to avoid collisions

* fix: remove unnecessary line breaks in 'whenToUse' descriptions for QA agents to mathc the rest of the agents definitions and improve programatic parsing of whenToUse prop

* fix: update OpenCode references to remove 'SST' for consistency across documentation and configuration

* fix: update agent mode from 'subagent' to 'all' for consistency in agent definitions

* fix: consolidate 'whenToUse' description format for clarity and consistent parsing
This commit is contained in:
Javier Gomez
2025-09-12 00:44:41 +02:00
committed by GitHub
parent 2b247ea385
commit f09e282d72
38 changed files with 915 additions and 96 deletions

View File

@@ -187,6 +187,53 @@ If you want to do the planning on the web with Claude (Sonnet 4 or Opus), Gemini
npx bmad-method install
```
### OpenCode
BMAD integrates with OpenCode via a project-level `opencode.jsonc`/`opencode.json` (JSON-only, no Markdown fallback).
- Installation:
- Run `npx bmad-method install` and choose `OpenCode` in the IDE list.
- The installer will detect an existing `opencode.jsonc`/`opencode.json` or create a minimal `opencode.jsonc` if missing.
- It will:
- Ensure `instructions` includes `.bmad-core/core-config.yaml` (and each selected expansion packs `config.yaml`).
- Merge BMAD agents and commands using file references (`{file:./.bmad-core/...}`), idempotently.
- Preserve other top-level fields and user-defined entries.
- Prefixes and collisions:
- You can opt-in to prefix agent keys with `bmad-` and command keys with `bmad:tasks:` to avoid name collisions.
- If a key already exists and is not BMAD-managed, the installer will skip it and suggest enabling prefixes.
- What gets added:
- `instructions`: `.bmad-core/core-config.yaml` plus any selected expansion pack `config.yaml` files.
- `agent`: BMAD agents from core and selected packs.
- `prompt`: `{file:./.bmad-core/agents/<id>.md}` (or pack path)
- `mode`: `primary` for orchestrators, otherwise `all`
- `tools`: `{ write: true, edit: true, bash: true }`
- `description`: extracted from the agents `whenToUse`
- `command`: BMAD tasks from core and selected packs.
- `template`: `{file:./.bmad-core/tasks/<id>.md}` (or pack path)
- `description`: extracted from the tasks “Purpose” section
- Selected Packages Only:
- The installer includes agents and tasks only from the packages you selected in the earlier step (core and chosen packs).
- Refresh after changes:
- Re-run:
```bash
npx bmad-method install -f -i opencode
```
- The installer safely updates entries without duplication and preserves your custom fields and comments.
- Optional convenience script:
- You can add a script to your projects `package.json` for quick refreshes:
```json
{
"scripts": {
"bmad:opencode": "bmad-method install -f -i opencode"
}
}
```
### Codex (CLI & Web)
BMAD integrates with OpenAI Codex via `AGENTS.md` and committed core agent files.
@@ -501,7 +548,7 @@ When creating custom web bundles or uploading to AI platforms, include your `tec
## Core Configuration
The `bmad-core/core-config.yaml` file is a critical config that enables BMad to work seamlessly with differing project structures, more options will be made available in the future. Currently the most important is the devLoadAlwaysFiles list section in the yaml.
The `.bmad-core/core-config.yaml` file is a critical config that enables BMad to work seamlessly with differing project structures, more options will be made available in the future. Currently the most important is the devLoadAlwaysFiles list section in the yaml.
### Developer Context Files