From 61f3cdfaa2e1388658d9bccee2a8e8d33665e1fa Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 29 Jul 2026 01:01:51 -0400 Subject: [PATCH] fix(onboard): reject noninteractive TUI mode (#115573) --- src/commands/onboard.test.ts | 14 ++++++++++++++ src/commands/onboard.ts | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/src/commands/onboard.test.ts b/src/commands/onboard.test.ts index acf52a46fa30..13c165240789 100644 --- a/src/commands/onboard.test.ts +++ b/src/commands/onboard.test.ts @@ -885,4 +885,18 @@ describe("setupWizardCommand", () => { expect(mocks.runInteractiveSetup).not.toHaveBeenCalled(); expect(mocks.runGuidedOnboarding).not.toHaveBeenCalled(); }); + + it("rejects conflicting TUI and non-interactive modes", async () => { + const runtime = makeRuntime(); + + await setupWizardCommand({ tui: true, nonInteractive: true, acceptRisk: true }, runtime); + + expect(runtime.error).toHaveBeenCalledWith( + "--tui cannot be combined with --non-interactive. Remove --tui for automation, or remove --non-interactive to open the terminal hatch.", + ); + expect(runtime.exit).toHaveBeenCalledWith(1); + expect(mocks.runNonInteractiveSetup).not.toHaveBeenCalled(); + expect(mocks.runInteractiveSetup).not.toHaveBeenCalled(); + expect(mocks.runGuidedOnboarding).not.toHaveBeenCalled(); + }); }); diff --git a/src/commands/onboard.ts b/src/commands/onboard.ts index ab4a6dbf08b4..8e836bc2694a 100644 --- a/src/commands/onboard.ts +++ b/src/commands/onboard.ts @@ -473,6 +473,13 @@ export async function setupWizardCommand( runtime.exit(1); return; } + if (normalizedOpts.tui && normalizedOpts.nonInteractive) { + runtime.error( + "--tui cannot be combined with --non-interactive. Remove --tui for automation, or remove --non-interactive to open the terminal hatch.", + ); + runtime.exit(1); + return; + } if ( normalizedOpts.secretInputMode && normalizedOpts.secretInputMode !== "plaintext" && // pragma: allowlist secret