diff --git a/tools/installer/commands/install.js b/tools/installer/commands/install.js index 61598a2cf..4df7981ed 100644 --- a/tools/installer/commands/install.js +++ b/tools/installer/commands/install.js @@ -96,7 +96,18 @@ module.exports = { } const config = await ui.promptInstall(options); - config.noBadge = options.badge === false; + + // Ask about badge unless --no-badge or --yes + if (options.badge === false) { + config.noBadge = true; + } else if (options.yes) { + config.noBadge = false; + } else { + config.noBadge = !(await prompts.confirm({ + message: 'Add BMAD badge to your README?', + default: true, + })); + } // Handle cancel if (config.actionType === 'cancel') { diff --git a/tools/installer/core/badge.js b/tools/installer/core/badge.js index 7623c256b..0a9b250f5 100644 --- a/tools/installer/core/badge.js +++ b/tools/installer/core/badge.js @@ -73,6 +73,11 @@ function removeBadge(content) { .join('\n'); } +function createReadmeWithBadge(owner, repo, projectName) { + const badgeLine = generateBadgeMarkdown(owner, repo); + return `# ${projectName}\n\n${badgeLine}\n`; +} + module.exports = { resolveGitRemote, findReadme, @@ -80,4 +85,5 @@ module.exports = { generateBadgeMarkdown, injectBadge, removeBadge, + createReadmeWithBadge, }; diff --git a/tools/installer/core/installer.js b/tools/installer/core/installer.js index b6c2d8e52..580ecb57d 100644 --- a/tools/installer/core/installer.js +++ b/tools/installer/core/installer.js @@ -1061,7 +1061,12 @@ class Installer { const readmePath = await badge.findReadme(projectDir); if (!readmePath) { - addResult('Badge', 'warn', 'no README found'); + // No README — create one with the badge + const projectName = path.basename(projectDir); + const content = badge.createReadmeWithBadge(remote.owner, remote.repo, projectName); + const newReadmePath = path.join(projectDir, 'README.md'); + await fs.writeFile(newReadmePath, content, 'utf8'); + addResult('Badge', 'ok', 'created README.md with badge'); return; }