From 2077bd30e8df722c1a3beee038b00983d5c3ec03 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 16 Jun 2026 11:57:35 +0200 Subject: [PATCH] fix(git-node): prefill both patch and minor versions when requesting CVEs --- lib/cli.js | 10 ++++++++++ lib/update_security_release.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index dfb6cc75..f51fd3e3 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -94,6 +94,16 @@ export default class CLI { return answer; } + async promptRadio(message, choices, opts = undefined) { + if (Object.hasOwn(opts, 'defaultAnswer')) { + opts.default = opts.defaultAnswer; + } + return inquirer.select({ + ...opts, + message, choices, + }); + } + async promptCheckbox(message, choices) { if (this.assumeYes) { return choices.filter((c) => c.checked).map((c) => c.value); diff --git a/lib/update_security_release.js b/lib/update_security_release.js index 8125e648..70b1ea6c 100644 --- a/lib/update_security_release.js +++ b/lib/update_security_release.js @@ -290,10 +290,10 @@ Summary: ${summary}\n`, const nextPatchVersion = semver.inc(version, 'patch'); const nextMinorVersion = semver.inc(version, 'minor'); - const patchedVersion = await this.cli.prompt( + const patchedVersion = await this.cli.promptRadio( `What is the patched version (>=) for release line ${affectedVersion}?`, + [nextPatchVersion, nextMinorVersion], { - questionType: 'input', defaultAnswer: isPatchRelease ? nextPatchVersion : nextMinorVersion });