-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge
More file actions
54 lines (46 loc) · 1.59 KB
/
Copy pathforge
File metadata and controls
54 lines (46 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
// ------------------------------------------------------------
// Forge — top-level CLI dispatcher
//
// Provides the `forge benchmark <command>` surface described in the
// Benchmarking PRD (§13, §958). The gateway has no built-in CLI yet,
// so this root launcher delegates `forge benchmark ...` to the
// Node-based benchmarking framework at loadtests/cli.js.
//
// Usage:
// forge benchmark list
// forge benchmark baseline
// forge benchmark all --skip soak
// forge benchmark report results/*.json -o report.md
// forge benchmark compare run-a run-b
// forge benchmark doctor
// forge benchmark clean
//
// Any other subcommand falls through to `node` for forwards-compat.
// ------------------------------------------------------------
import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = __dirname;
const CLI = join(ROOT, "loadtests", "cli.js");
function main() {
const [, , group, ...rest] = process.argv;
if (group === "benchmark") {
const res = spawnSync("node", [CLI, ...rest], {
stdio: "inherit",
env: process.env,
});
process.exit(res.status ?? 0);
}
if (!group) {
console.log(`Forge CLI
Usage:
forge benchmark <command> Benchmarking framework (list|run|all|report|compare|doctor|clean)
forge help Show this message`);
process.exit(0);
}
console.error(`Unknown forge command: ${group}. Try 'forge benchmark list'.`);
process.exit(1);
}
main();