mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 12:26:38 -06:00
3c06621e3b
* perf(test): collapse core tooling runtime proofs * fix(test): import OTEL span id guard
31 lines
929 B
TypeScript
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 };
|
|
}
|