From dfbc9ab246ea5c44acc8c302498f349de7290fe8 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 22:52:08 +0200 Subject: [PATCH] fix(scripts): reject short flag TUI PTY values --- scripts/dev/tui-pty-test-watch.ts | 2 +- test/scripts/dev-tooling-safety.test.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/dev/tui-pty-test-watch.ts b/scripts/dev/tui-pty-test-watch.ts index 7a79f46fc192..e6f83424ef14 100644 --- a/scripts/dev/tui-pty-test-watch.ts +++ b/scripts/dev/tui-pty-test-watch.ts @@ -63,7 +63,7 @@ function readOption(args: string[], name: string): string | undefined { return undefined; } const value = args[idx + 1]; - if (!value || value.startsWith("--")) { + if (!value || value.startsWith("-")) { throw new CliArgumentError(`${name} requires a value`); } return value.trim(); diff --git a/test/scripts/dev-tooling-safety.test.ts b/test/scripts/dev-tooling-safety.test.ts index 2963546624b0..69b5ddec77a4 100644 --- a/test/scripts/dev-tooling-safety.test.ts +++ b/test/scripts/dev-tooling-safety.test.ts @@ -356,6 +356,14 @@ describe("script-specific dev tooling hardening", () => { expect(result.stdout).toBe(""); }); + it("rejects short flags as TUI PTY watch option values", () => { + for (const flag of ["--mode", "--mirror-path"]) { + expect(() => tuiPtyWatchTesting.parseOptions([flag, "-h"])).toThrow( + `${flag} requires a value`, + ); + } + }); + it("keeps TUI PTY watch vitest args behind the separator", () => { expect(tuiPtyWatchTesting.parseOptions(["--mode", "all", "--", "--help"])).toMatchObject({ mode: "all",