Compare commits

..

No commits in common. "be85e5b4a01664f2f4a2a80c9960f65bb30f8b22" and "88b9a1c8421e1ad15288df00059d5b4f1ed85af3" have entirely different histories.

5 changed files with 27 additions and 103 deletions

View File

@ -7,7 +7,6 @@ on:
- "src/**"
- "tools/installer/**"
- "package.json"
- "removals.txt"
workflow_dispatch:
inputs:
channel:
@ -136,22 +135,6 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Advance @next dist-tag to stable
if: github.event_name == 'workflow_dispatch' && inputs.channel == 'latest'
# Failure here leaves @next stale until the next push-driven prerelease
# republishes — annoying but not release-breaking. Don't fail the job
# after a successful stable publish + tag + GH release.
continue-on-error: true
run: |
# Without this, @latest can leapfrog @next (e.g. latest=6.5.0 while
# next=6.4.1-next.0) and `npx bmad-method@next install` silently
# downgrades users. Point @next at the just-published stable so
# @next >= @latest always holds; the next push-driven prerelease will
# bump from this base via the existing derive step above.
VERSION=$(node -p 'require("./package.json").version')
npm dist-tag add "bmad-method@${VERSION}" next
echo "Advanced @next dist-tag to ${VERSION}"
- name: Notify Discord
if: github.event_name == 'workflow_dispatch' && inputs.channel == 'latest'
continue-on-error: true

View File

@ -23,10 +23,13 @@ checkForUpdate().catch(() => {
async function checkForUpdate() {
try {
// Prereleases (e.g. 6.5.1-next.0) live on the `next` dist-tag; stable
// releases live on `latest`. semver.prerelease() returns null for stable,
// so this correctly routes pre-1.0-next/rc/etc. without string matching.
const tag = semver.prerelease(packageJson.version) ? 'next' : 'latest';
// For beta versions, check the beta tag; otherwise check latest
const isBeta =
packageJson.version.includes('Beta') ||
packageJson.version.includes('beta') ||
packageJson.version.includes('alpha') ||
packageJson.version.includes('rc');
const tag = isBeta ? 'beta' : 'latest';
const result = execSync(`npm view ${packageName}@${tag} version`, {
encoding: 'utf8',

View File

@ -435,9 +435,6 @@ class ManifestGenerator {
// this means user-scoped keys (e.g. user_name) could mis-file into the
// team config, so the operator should notice.
const scopeByModuleKey = {};
// Maps installer moduleName (may be full display name) → module code field
// from module.yaml, so TOML sections use [modules.<code>] not [modules.<name>].
const codeByModuleName = {};
for (const moduleName of this.updatedModules) {
const moduleYamlPath = await resolveInstalledModuleYaml(moduleName);
if (!moduleYamlPath) {
@ -450,7 +447,6 @@ class ManifestGenerator {
try {
const parsed = yaml.parse(await fs.readFile(moduleYamlPath, 'utf8'));
if (!parsed || typeof parsed !== 'object') continue;
if (parsed.code) codeByModuleName[moduleName] = parsed.code;
scopeByModuleKey[moduleName] = {};
for (const [key, value] of Object.entries(parsed)) {
if (value && typeof value === 'object' && 'prompt' in value) {
@ -549,9 +545,6 @@ class ManifestGenerator {
if (moduleName === 'core') continue;
const cfg = moduleConfigs[moduleName];
if (!cfg || Object.keys(cfg).length === 0) continue;
// Use the module's code field from module.yaml as the TOML key so the
// section is [modules.mdo] not [modules.MDO: Maxio DevOps Operations].
const sectionKey = codeByModuleName[moduleName] || moduleName;
// Only filter out spread-from-core pollution when we actually know
// this module's prompt schema. For external/marketplace modules whose
// module.yaml isn't in the src tree, fall through as all-team so we
@ -559,14 +552,14 @@ class ManifestGenerator {
const haveSchema = Object.keys(scopeByModuleKey[moduleName] || {}).length > 0;
const { team: modTeam, user: modUser } = partition(moduleName, cfg, haveSchema);
if (Object.keys(modTeam).length > 0) {
teamLines.push(`[modules.${sectionKey}]`);
teamLines.push(`[modules.${moduleName}]`);
for (const [key, value] of Object.entries(modTeam)) {
teamLines.push(`${key} = ${formatTomlValue(value)}`);
}
teamLines.push('');
}
if (Object.keys(modUser).length > 0) {
userLines.push(`[modules.${sectionKey}]`);
userLines.push(`[modules.${moduleName}]`);
for (const [key, value] of Object.entries(modUser)) {
userLines.push(`${key} = ${formatTomlValue(value)}`);
}

View File

@ -86,8 +86,6 @@ function getExternalModuleCachePath(moduleName, ...segments) {
* Built-in modules (core, bmm) live under <src>. External official modules are
* cloned into ~/.bmad/cache/external-modules/<name>/ with varying internal
* layouts (some at src/module.yaml, some at skills/module.yaml, some nested).
* Local custom-source modules are not cached; their path is read from the
* CustomModuleManager resolution cache set during the same install run.
* This mirrors the candidate-path search in
* ExternalModuleManager.findExternalModuleSource but performs no git/network
* work, which keeps it safe to call during manifest writing.
@ -99,57 +97,27 @@ async function resolveInstalledModuleYaml(moduleName) {
const builtIn = path.join(getModulePath(moduleName), 'module.yaml');
if (await fs.pathExists(builtIn)) return builtIn;
// Search a resolved root directory using the same candidate-path pattern.
async function searchRoot(root) {
for (const dir of ['skills', 'src']) {
const direct = path.join(root, dir, 'module.yaml');
if (await fs.pathExists(direct)) return direct;
const dirPath = path.join(root, dir);
if (await fs.pathExists(dirPath)) {
const entries = await fs.readdir(dirPath, { withFileTypes: true });
for (const entry of entries) {
if (!entry.isDirectory()) continue;
const nested = path.join(dirPath, entry.name, 'module.yaml');
if (await fs.pathExists(nested)) return nested;
}
}
}
// BMB standard: {setup-skill}/assets/module.yaml (setup skill is any *-setup directory)
const rootEntries = await fs.readdir(root, { withFileTypes: true });
for (const entry of rootEntries) {
if (!entry.isDirectory() || !entry.name.endsWith('-setup')) continue;
const setupAssets = path.join(root, entry.name, 'assets', 'module.yaml');
if (await fs.pathExists(setupAssets)) return setupAssets;
}
const atRoot = path.join(root, 'module.yaml');
if (await fs.pathExists(atRoot)) return atRoot;
return null;
}
const cacheRoot = getExternalModuleCachePath(moduleName);
if (await fs.pathExists(cacheRoot)) {
const found = await searchRoot(cacheRoot);
if (found) return found;
}
if (!(await fs.pathExists(cacheRoot))) return null;
// Fallback: local custom-source modules store their source path in the
// CustomModuleManager resolution cache populated during the same install run.
// Match by code OR name since callers may use either form.
try {
const { CustomModuleManager } = require('./modules/custom-module-manager');
for (const [, mod] of CustomModuleManager._resolutionCache) {
if ((mod.code === moduleName || mod.name === moduleName) && mod.localPath) {
const found = await searchRoot(mod.localPath);
if (found) return found;
for (const dir of ['skills', 'src']) {
const direct = path.join(cacheRoot, dir, 'module.yaml');
if (await fs.pathExists(direct)) return direct;
const dirPath = path.join(cacheRoot, dir);
if (await fs.pathExists(dirPath)) {
const entries = await fs.readdir(dirPath, { withFileTypes: true });
for (const entry of entries) {
if (!entry.isDirectory()) continue;
const nested = path.join(dirPath, entry.name, 'module.yaml');
if (await fs.pathExists(nested)) return nested;
}
}
} catch {
// Resolution cache unavailable — continue
}
const atRoot = path.join(cacheRoot, 'module.yaml');
if (await fs.pathExists(atRoot)) return atRoot;
return null;
}

View File

@ -2,7 +2,6 @@ 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');
@ -129,24 +128,6 @@ 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) {
@ -351,10 +332,8 @@ 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. 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.
// selected. 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);
@ -1804,9 +1783,7 @@ class UI {
*
* Skipped when:
* - running non-interactively (--yes)
* - 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)
* - the user already passed channel flags (--channel / --pin / --next)
* - no externals/community modules are selected
*
* Mutates channelOptions.pins and channelOptions.nextSet to reflect picker choices.