Files
openclaw/test/e2e/qa-lab/runtime/gateway-stability-runtime-contract.ts
Peter Steinberger 3c06621e3b improve(test): cut core tooling 3 runtime (#123659)
* perf(test): collapse core tooling runtime proofs

* fix(test): import OTEL span id guard
2026-08-14 06:35:48 -07:00

31 lines
929 B
TypeScript

// Pure CLI contract shared by the Gateway stability script and fast unit coverage.
import path from "node:path";
export type GatewayStabilityRuntimeOptions = {
artifactBase: string;
repoRoot: string;
};
export function parseGatewayStabilityRuntimeOptions(
argv: readonly string[],
repoRoot = process.cwd(),
): GatewayStabilityRuntimeOptions {
let artifactBase: string | undefined;
for (let index = 0; index < argv.length; index += 1) {
const option = argv[index];
const value = argv[index + 1];
if (option !== "--artifact-base") {
throw new Error(`unknown argument: ${option}`);
}
if (!value || value.startsWith("--")) {
throw new Error("--artifact-base requires a value");
}
artifactBase = value;
index += 1;
}
if (!artifactBase) {
throw new Error("--artifact-base is required");
}
return { artifactBase: path.resolve(repoRoot, artifactBase), repoRoot };
}