@@ -367,11 +367,13 @@ export function renderTestEnvMutationReport(
|
367 | 367 | } |
368 | 368 | |
369 | 369 | function parseArgs(argv: string[]): { |
| 370 | + help: boolean; |
370 | 371 | includeAllowed: boolean; |
371 | 372 | json: boolean; |
372 | 373 | limit: number; |
373 | 374 | repoRoot: string; |
374 | 375 | } { |
| 376 | +let help = false; |
375 | 377 | let includeAllowed = false; |
376 | 378 | let json = false; |
377 | 379 | let limit = 120; |
@@ -382,6 +384,10 @@ function parseArgs(argv: string[]): {
|
382 | 384 | if (arg === "--") { |
383 | 385 | continue; |
384 | 386 | } |
| 387 | +if (arg === "--help" || arg === "-h") { |
| 388 | + help = true; |
| 389 | +continue; |
| 390 | +} |
385 | 391 | if (arg === "--include-allowed") { |
386 | 392 | includeAllowed = true; |
387 | 393 | continue; |
@@ -411,11 +417,31 @@ function parseArgs(argv: string[]): {
|
411 | 417 | throw new Error(`Unknown argument: ${arg}`); |
412 | 418 | } |
413 | 419 | |
414 | | -return { includeAllowed, json, limit, repoRoot }; |
| 420 | +return { help, includeAllowed, json, limit, repoRoot }; |
| 421 | +} |
| 422 | + |
| 423 | +function printHelp(): void { |
| 424 | +process.stdout.write(`OpenClaw test env mutation report |
| 425 | + |
| 426 | +Usage: |
| 427 | + pnpm test:env-mutations:report [options] |
| 428 | + |
| 429 | +Options: |
| 430 | + --include-allowed Include allowed harness findings in text output |
| 431 | + --json Print the full JSON report |
| 432 | + --limit <n> Maximum text findings to print; use 0 for all (default: 120) |
| 433 | + --repo-root <path> Repository root to scan (default: current working directory) |
| 434 | + --help, -h Show this help message |
| 435 | +`); |
415 | 436 | } |
416 | 437 | |
417 | 438 | export function main(argv = process.argv.slice(2)): number { |
418 | 439 | const args = parseArgs(argv); |
| 440 | +if (args.help) { |
| 441 | +printHelp(); |
| 442 | +return 0; |
| 443 | +} |
| 444 | + |
419 | 445 | const report = collectTestEnvMutationReport({ repoRoot: args.repoRoot }); |
420 | 446 | if (args.json) { |
421 | 447 | process.stdout.write(`${JSON.stringify(report, null, 2)}\n`); |
|