fix(onboard): reject noninteractive TUI mode (#115573)

This commit is contained in:
Peter Steinberger
2026-07-29 01:01:51 -04:00
committed by GitHub
parent 710efc9a86
commit 61f3cdfaa2
2 changed files with 21 additions and 0 deletions
+14
View File
@@ -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();
});
});
+7
View File
@@ -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