refactor(scripts): share gateway smoke option tracking (#161605)

This commit is contained in:
Peter Steinberger 2026-09-29 21:43:00 -07:00 • committed by GitHub
parent 91bcd2d68a
commit 006de59604
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,3 @@
// Gateway Smoke script supports OpenClaw repository automation.
import { fileURLToPath } from "node:url";
import { isRecord } from "@openclaw/normalization-core/record-coerce";
import {
@ -52,26 +51,19 @@ function validateArgs(argv: readonly string[]): void {
const seen = new Set<string>();
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index] ?? "";
if (BOOLEAN_FLAGS.has(arg)) {
if (seen.has(arg)) {
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
}
seen.add(arg);
continue;
}
if (VALUE_FLAGS.has(arg)) {
const value = argv[index + 1];
if (!value || value.startsWith("-")) {
throw new GatewaySmokeArgError(`${arg} requires a value`);
}
if (seen.has(arg)) {
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
}
seen.add(arg);
index += 1;
continue;
} else if (!BOOLEAN_FLAGS.has(arg)) {
throw new GatewaySmokeArgError(`Unknown argument: ${arg}`);
}
throw new GatewaySmokeArgError(`Unknown argument: ${arg}`);
if (seen.has(arg)) {
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
}
seen.add(arg);
}
}