Skip to content

Commit 6d5eefc

Browse files
committed
fix: include warnings in cli setup JSON output
Warnings from best-effort steps (e.g. permission errors during completions install) are now collected into SetupResult.warnings and included in --json output. They're still logged to stderr via logger.warn() for real-time human feedback.
1 parent 23118ad commit 6d5eefc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/commands/cli/setup.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ type Logger = (msg: string) => void;
5959
type SetupResult = {
6060
/** Status messages collected during setup */
6161
messages: string[];
62+
/** Warning messages from best-effort steps that failed non-fatally */
63+
warnings: string[];
6264
/** Whether a fresh binary was installed */
6365
freshInstall: boolean;
6466
/** Path to the installed binary */
@@ -463,6 +465,7 @@ export const setupCommand = buildCommand({
463465

464466
const log = logger.withTag("cli.setup");
465467
const messages: string[] = [];
468+
const warnings: string[] = [];
466469

467470
const emit: Logger = (msg: string) => {
468471
if (!flags.quiet) {
@@ -473,7 +476,9 @@ export const setupCommand = buildCommand({
473476
const warn: WarnLogger = (step, error) => {
474477
const msg =
475478
error instanceof Error ? error.message : "Unknown error occurred";
476-
log.warn(`${step} failed: ${msg}`);
479+
const warning = `${step} failed: ${msg}`;
480+
log.warn(warning);
481+
warnings.push(warning);
477482
};
478483

479484
let binaryPath = process.execPath;
@@ -512,6 +517,7 @@ export const setupCommand = buildCommand({
512517

513518
return yield new CommandOutput<SetupResult>({
514519
messages,
520+
warnings,
515521
freshInstall,
516522
binaryPath,
517523
version: CLI_VERSION,

0 commit comments

Comments
 (0)