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

@@ -49,7 +49,7 @@ program
.option('-d, --directory <path>', 'Installation directory')
.option(
'-i, --ide <ide...>',
'Configure for specific IDE(s) - can specify multiple (cursor, claude-code, windsurf, trae, roo, kilo, cline, gemini, qwen-code, github-copilot, codex, codex-web, auggie-cli, iflow-cli, other)',
'Configure for specific IDE(s) - can specify multiple (cursor, claude-code, windsurf, trae, roo, kilo, cline, gemini, qwen-code, github-copilot, codex, codex-web, auggie-cli, iflow-cli, opencode, other)',
)
.option(
'-e, --expansion-packs <packs...>',
@@ -410,6 +410,7 @@ async function promptInstallation() {
{ name: 'Auggie CLI (Augment Code)', value: 'auggie-cli' },
{ name: 'Codex CLI', value: 'codex' },
{ name: 'Codex Web', value: 'codex-web' },
{ name: 'OpenCode', value: 'opencode' },
],
},
]);
@@ -478,6 +479,43 @@ async function promptInstallation() {
answers.githubCopilotConfig = { configChoice };
}
// Configure OpenCode immediately if selected
if (ides.includes('opencode')) {
console.log(chalk.cyan('\n⚙ OpenCode Configuration'));
console.log(
chalk.dim(
'OpenCode will include agents and tasks from the packages you selected above; choose optional key prefixes (defaults: no prefixes).\n',
),
);
const { useAgentPrefix, useCommandPrefix } = await inquirer.prompt([
{
type: 'confirm',
name: 'useAgentPrefix',
message: "Prefix agent keys with 'bmad-'? (e.g., 'bmad-dev')",
default: true,
},
{
type: 'confirm',
name: 'useCommandPrefix',
message: "Prefix command keys with 'bmad:tasks:'? (e.g., 'bmad:tasks:create-doc')",
default: true,
},
]);
answers.openCodeConfig = {
opencode: {
useAgentPrefix,
useCommandPrefix,
},
// pass previously selected packages so IDE setup only applies those
selectedPackages: {
includeCore: selectedItems.includes('bmad-core'),
packs: answers.expansionPacks || [],
},
};
}
// Configure Auggie CLI (Augment Code) immediately if selected
if (ides.includes('auggie-cli')) {
console.log(chalk.cyan('\n📍 Auggie CLI Location Configuration'));