From 04cfde145418392ac119a8d027d96c82555c6251 Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 26 Apr 2026 10:54:38 -0500 Subject: [PATCH] fix(installer): mirror launch channel as default for external modules (#2321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(installer): mirror launch channel as default for external modules When the user runs `npx bmad-method@next install`, the installer itself runs from a prerelease, but the interactive channel gate previously hardcoded "(all stable)" — defaulting tea/community modules to stable while bmad-method itself was on next. The bleeding-edge launch did not flow through. Detect the installer's own version via semver.prerelease() and default the gate (and per-module picker) to match — "all next" for prerelease launches, "all stable" for stable. Users keep full control: hit "n" to customize per module, or pass explicit --channel / --pin / --next flags to override. * fix(installer): seed channelOptions before module picker, not gate CodeRabbit caught a label/install mismatch in the previous approach: the module picker resolves version labels via decideChannelForModule, which runs before _interactiveChannelGate. With channelOptions.global still null at picker time, labels rendered from stable tags — then the gate flipped global to 'next' and externals installed from main HEAD. Net effect on @next launches: "tea (v1.6.0)" in the picker, but install pulled HEAD. Move the launch detection up into promptInstall, immediately after parseChannelOptions. Seeding channelOptions.global = 'next' before the picker makes labels resolve from main HEAD (matching the install) and lets the existing gate's haveFlagIntent check skip cleanly — the @next user already declared their intent by typing it. Per-module customization remains available via --pin / --next / --channel flags, same as for any pre-set global. --- tools/installer/ui.js | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tools/installer/ui.js b/tools/installer/ui.js index f2f6e31c1..4ec0ef118 100644 --- a/tools/installer/ui.js +++ b/tools/installer/ui.js @@ -2,6 +2,7 @@ const path = require('node:path'); const os = require('node:os'); const semver = require('semver'); const fs = require('./fs-native'); +const installerPackageJson = require('../../package.json'); const { CLIUtils } = require('./cli-utils'); const { ExternalModuleManager } = require('./modules/external-manager'); const { resolveModuleVersion } = require('./modules/version-resolver'); @@ -128,6 +129,24 @@ class UI { await prompts.log.warn(warning); } + // When the user launched the installer from a prerelease (npx bmad-method@next), + // mirror that intent for external modules: seed the global channel to 'next' so + // the module picker's version labels resolve from main HEAD (matching what + // actually gets installed) and the interactive channel gate skips — the user + // already declared "next" intent by typing @next. Explicit channel flags + // override this seed. + if ( + semver.prerelease(installerPackageJson.version) !== null && + !channelOptions.global && + channelOptions.nextSet.size === 0 && + channelOptions.pins.size === 0 + ) { + channelOptions.global = 'next'; + await prompts.log.info( + 'Launched from a prerelease — installing all external modules from main HEAD (next channel). Pass --all-stable or --pin to override.', + ); + } + // Get directory from options or prompt let confirmedDirectory; if (options.directory) { @@ -332,8 +351,10 @@ class UI { // Interactive channel gate: "Ready to install (all stable)? [Y/n]" // Only shown for fresh installs with no channel flags and an external module - // selected. Non-interactive installs skip this and fall through to the - // registry default (stable) or whatever flags were supplied. + // selected. Skipped for prerelease launches because channelOptions.global + // was already seeded to 'next' upstream. Non-interactive installs skip this + // and fall through to the registry default (stable) or whatever flags were + // supplied. await this._interactiveChannelGate({ options, channelOptions, selectedModules }); let toolSelection = await this.promptToolSelection(confirmedDirectory, options); @@ -1783,7 +1804,9 @@ class UI { * * Skipped when: * - running non-interactively (--yes) - * - the user already passed channel flags (--channel / --pin / --next) + * - the user already passed channel flags (--channel / --pin / --next), OR + * the installer was launched from a prerelease (which seeds + * channelOptions.global = 'next' upstream in promptInstall) * - no externals/community modules are selected * * Mutates channelOptions.pins and channelOptions.nextSet to reflect picker choices.