From af0e767ecf1b91d41f114e1a5d7bf5da08de57d6 Mon Sep 17 00:00:00 2001 From: Brian Madison Date: Thu, 19 Jun 2025 12:43:58 -0500 Subject: [PATCH] fix: prevent double installation when updating v4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added flag to prevent installer.install() being called twice - Fixed undefined 'directory' error by using answers.directory - Update flow now completes without errors - Prevents 'Cannot read properties of undefined' error after successful update 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tools/installer/bin/bmad.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/installer/bin/bmad.js b/tools/installer/bin/bmad.js index e27fc971..99d22c9b 100755 --- a/tools/installer/bin/bmad.js +++ b/tools/installer/bin/bmad.js @@ -58,7 +58,9 @@ program if (!options.full && !options.agent && !options.team && !options.expansionOnly) { // Interactive mode const answers = await promptInstallation(); - await installer.install(answers); + if (!answers._alreadyInstalled) { + await installer.install(answers); + } } else { // Direct mode let installType = 'full'; @@ -181,7 +183,9 @@ async function promptInstallation() { if (shouldUpdate) { // Skip other prompts and go directly to update answers.installType = 'update'; - return await installer.install(answers); + answers._alreadyInstalled = true; // Flag to prevent double installation + await installer.install(answers); + return answers; // Return the answers object } // If user doesn't want to update, continue with normal flow } @@ -401,7 +405,7 @@ async function promptInstallation() { type: 'input', name: 'webBundlesDirectory', message: 'Enter directory for web bundles:', - default: `${directory}/web-bundles`, + default: `${answers.directory}/web-bundles`, validate: (input) => { if (!input.trim()) { return 'Please enter a valid directory path';