Skip to content

fix: suppress update banner in machine mode (--json / --quiet)#201

Merged
felipefreitag merged 4 commits intomainfrom
fix/cli-machine-mode-update-banner-3e94
Apr 10, 2026
Merged

fix: suppress update banner in machine mode (--json / --quiet)#201
felipefreitag merged 4 commits intomainfrom
fix/cli-machine-mode-update-banner-3e94

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Suppress the update banner in machine mode so --json or --quiet runs produce no stderr output, honoring the “JSON to stdout, nothing to stderr” contract. Resolves BU-651 by preventing noisy TTY runs from breaking automation.

  • Bug Fixes
    • Added UpdateCheckOptions and updated shouldSkipCheck to short-circuit when json is true.
    • Passed json: Boolean(globals.json || globals.quiet) from src/cli.ts into checkForUpdates.
    • Preserved existing behavior on TTY when machine mode is off.
    • Added regression tests covering --json, --quiet (cached), and explicit json: false.

Written for commit 7a6933f. Summary will update on new commits.

The background update notifier ignored explicit machine-mode flags
(--json / --quiet) and still wrote an update banner to stderr when
running in a TTY. This broke the documented machine-mode contract
that promises 'JSON to stdout, nothing to stderr'.

- Add UpdateCheckOptions type to checkForUpdates accepting a json flag
- Pass resolved global opts (json || quiet) from cli.ts into checkForUpdates
- Short-circuit shouldSkipCheck when json is true
- Add regression tests covering TTY + --json, TTY + --quiet, and
  explicit json: false scenarios

Resolves: BU-651

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
@bukinoshita
Copy link
Copy Markdown
Member Author

@cubic-dev-ai can you review?

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 9, 2026

@cubic-dev-ai can you review?

@bukinoshita I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@bukinoshita bukinoshita marked this pull request as ready for review April 10, 2026 16:19
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

felipefreitag and others added 2 commits April 10, 2026 15:22
Keep the PR's machine-mode suppression logic (passing json option to
checkForUpdates) while adopting main's void prefix style.
@felipefreitag felipefreitag merged commit a53e49d into main Apr 10, 2026
7 checks passed
@felipefreitag felipefreitag deleted the fix/cli-machine-mode-update-banner-3e94 branch April 10, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants