Repository navigation
feat: add v6 upgrade guardrails and allow installs without uv #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ import { resolve } from 'node:path' | |
| import { inspectInstall, installedModuleCodes } from '../installed.js' | ||
| import { message } from '../messages.js' | ||
| import { findModule, sourceAtRef } from '../modules.js' | ||
| import { runPreflight } from '../preflight.js' | ||
| import { runPreflight, uvInstallCommand } from '../preflight.js' | ||
| import { lockedRef, moduleSourceFromLock, readProjectLock } from '../project-lock.js' | ||
| import { agentsToUpdate } from './agent-choice.js' | ||
| import { applyCalls } from './apply.js' | ||
|
|
@@ -52,46 +52,55 @@ async function updateCalls(deps, directory, codes, installed) { | |
| * `checked` is set when install already ran the preflight checks and hands over to update. | ||
| * @param {CliOptions} options | ||
| * @param {CommandDeps} deps | ||
| * @param {{ checked?: boolean }} [context] | ||
| * @param {{ checked?: boolean, hasUv?: boolean }} [context] | ||
| * @returns {Promise<number>} | ||
| */ | ||
| export async function update(options, deps, context = {}) { | ||
| const { bmadScripts, messages, modules, prompts, runner, skillsCli, cwd } = deps | ||
| if (!context.checked) await runPreflight({ interactive: false, runner, messages }) | ||
| const hasUv = context.checked | ||
| ? (context.hasUv ?? true) | ||
| : (await runPreflight({ interactive: false, runner, messages })).uv !== null | ||
| if (!context.checked && !hasUv) { | ||
| prompts.warn(message(messages, 'uvMissing', { installCommand: uvInstallCommand(messages) })) | ||
| } | ||
|
|
||
| const directory = resolve(cwd, options.directory ?? cwd) | ||
| const before = await inspectInstall(directory, skillsCli) | ||
| const installedSkillDir = before.bmadSkillDir | ||
| if (!installedSkillDir) { | ||
| prompts.fail(message(messages, 'nothingToUpdate')) | ||
| prompts.fail(message(messages, before.legacyManifest ? 'legacyNoV7' : 'nothingToUpdate')) | ||
| return 1 | ||
| } | ||
|
|
||
| /** @type {StatusReport | null} */ | ||
| let wasInstalled = null | ||
| /** @type {string[]} */ | ||
| let unplaced = [] | ||
| const { failures, bmadSkillDir, report } = await applyCalls(deps, { | ||
| const { failures, bmadSkillDir, report, skills } = await applyCalls(deps, { | ||
| directory, | ||
| agents: agentsToUpdate(deps, directory), | ||
| spinner: 'updatingSpinner', | ||
| bmadSkillDir: installedSkillDir, | ||
| hasUv, | ||
| plan: async () => { | ||
| wasInstalled = await bmadScripts.status(installedSkillDir, directory).catch(() => null) | ||
| wasInstalled = hasUv ? await bmadScripts.status(installedSkillDir, directory).catch(() => null) : null | ||
| const codes = wasInstalled ? wasInstalled.modules.map((entry) => entry.module) : installedModuleCodes(before, modules) | ||
| const planned = await updateCalls(deps, directory, codes, wasInstalled) | ||
| unplaced = planned.unplaced | ||
| return planned.calls | ||
| }, | ||
| }) | ||
| if (!bmadSkillDir || !report) { | ||
| if (!bmadSkillDir || (hasUv && !report)) { | ||
| prompts.fail(message(messages, 'nothingToUpdate')) | ||
| return 1 | ||
| } | ||
| if (unplaced.length > 0) prompts.say(message(messages, 'updateNotListed', { modules: unplaced.join(', ') })) | ||
| // Without the first status there is no telling which modules beyond modules.yaml were installed. | ||
| if (!wasInstalled) prompts.warn(message(messages, 'updateUnreadInstall')) | ||
| if (hasUv && !wasInstalled) prompts.warn(message(messages, 'updateUnreadInstall')) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warn when a no-uv update skips modules outside Without uv, The README says On the no-uv path, state that modules outside the installer's list were not checked or updated. Use a message that names the uv cause; the existing
|
||
|
|
||
| await endRun(deps, { report, bmadSkillDir, before: versionsByCode(wasInstalled), failures, directory, updated: true }) | ||
| return failures.length === 0 && wasInstalled ? 0 : 1 | ||
| const fallbackModules = report | ||
| ? undefined | ||
| : installedModuleCodes({ skills, bmadSkillDir, legacyManifest: false }, modules) | ||
| await endRun(deps, { report, bmadSkillDir, before: versionsByCode(wasInstalled), failures, directory, updated: true, fallbackModules }) | ||
| return failures.length === 0 && (!hasUv || Boolean(wasInstalled)) ? 0 : 1 | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exclude failed custom modules from the no-
uvinstalled-module summary.When
uvis missing,installbuildsfallbackModulesfrom the chosen custom modules without checking whether each one installed. Each custom source from--modulesor a picked source string getscustom: true(src/modules.js:211-213). If that module's add call fails, the failure warning still appears, but the module code also stays infallbackModulesand is passed to the module list in the summary. The result is a failed module that the summary reports as present.Filter the custom entries against the recorded failures before building
fallbackModules, so that a custom module appears only when its add call succeeded. The no-uvpath is the only one affected, becausereportis present otherwise.