From 648ef73bde1b3ea7f3378053d655ff72c73e0a64 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 22:15:12 +0200 Subject: [PATCH] fix(qa): reject short flag UX evidence paths --- scripts/qa/ux-matrix-evidence-producer.ts | 12 +++++++++++- test/scripts/qa-ux-matrix-evidence-producer.test.ts | 10 ++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/qa/ux-matrix-evidence-producer.ts b/scripts/qa/ux-matrix-evidence-producer.ts index 1bc7ba842307..613fc6a9acc5 100644 --- a/scripts/qa/ux-matrix-evidence-producer.ts +++ b/scripts/qa/ux-matrix-evidence-producer.ts @@ -60,7 +60,17 @@ function readOptionValue(argv: readonly string[], index: number, arg: string) { } function isHelpRequest(argv: readonly string[]) { - return argv.length === 1 && (argv[0] === "--help" || argv[0] === "-h"); + for (let index = 0; index < argv.length; index += 1) { + const arg = argv[index]; + if (arg === "--artifact-base" || arg === "--repo-root") { + index += 1; + continue; + } + if (arg === "--help" || arg === "-h") { + return true; + } + } + return false; } function parseOptions(argv: readonly string[]): ProducerOptions { diff --git a/test/scripts/qa-ux-matrix-evidence-producer.test.ts b/test/scripts/qa-ux-matrix-evidence-producer.test.ts index 1bac3f723096..d6f8f8eeedc4 100644 --- a/test/scripts/qa-ux-matrix-evidence-producer.test.ts +++ b/test/scripts/qa-ux-matrix-evidence-producer.test.ts @@ -34,6 +34,16 @@ describe("QA UX Matrix evidence producer CLI", () => { expect(result.stderr).toBe(""); }); + it("prints help after boolean options without consuming valued option slots", () => { + const result = runCli("--skip-visual-proof", "--help"); + + expect(result.status).toBe(0); + expect(result.stdout).toContain( + "Usage: node --import tsx scripts/qa/ux-matrix-evidence-producer.ts", + ); + expect(result.stderr).toBe(""); + }); + it("reports invalid args without a Node stack trace", () => { const result = runCli("--wat");