From 8102d5ebc309df9bec8d858af587bf9f1e324dce Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 22:02:05 +0200 Subject: [PATCH] fix(scripts): reject short flag performance summary paths --- scripts/openclaw-performance-source-summary.mjs | 2 +- test/scripts/openclaw-performance-source-summary.test.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/openclaw-performance-source-summary.mjs b/scripts/openclaw-performance-source-summary.mjs index 5cb772fb1d3..3e505ffad06 100644 --- a/scripts/openclaw-performance-source-summary.mjs +++ b/scripts/openclaw-performance-source-summary.mjs @@ -8,7 +8,7 @@ import { pathToFileURL } from "node:url"; function readOptionValue(argv, index, optionName) { const value = argv[index + 1]; - if (!value || value.startsWith("--")) { + if (!value || value.startsWith("-")) { throw new Error(`${optionName} requires a value`); } return value; diff --git a/test/scripts/openclaw-performance-source-summary.test.ts b/test/scripts/openclaw-performance-source-summary.test.ts index c8de48d5df4..4e431dc2ea4 100644 --- a/test/scripts/openclaw-performance-source-summary.test.ts +++ b/test/scripts/openclaw-performance-source-summary.test.ts @@ -134,6 +134,7 @@ describe("parseArgs", () => { for (const flag of ["--source-dir", "--baseline-source-dir", "--output"]) { expect(() => parseArgs([flag])).toThrow(`${flag} requires a value`); expect(() => parseArgs([flag, ""])).toThrow(`${flag} requires a value`); + expect(() => parseArgs([flag, "-h"])).toThrow(`${flag} requires a value`); expect(() => parseArgs([flag, "--source-dir", "reports/current"])).toThrow( `${flag} requires a value`, );