File size: 1,356 Bytes
38be44d | 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 | #!/usr/bin/env tsx
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { collectInventory } from './utils/eval-inventory.js';
import { buildToolRegistry } from './utils/tool-registry.js';
import {
computeCoverage,
formatCoverageReport,
} from './utils/eval-coverage.js';
async function main() {
const rootFlagIndex = process.argv.indexOf('--root');
const rootFlagValue =
rootFlagIndex !== -1 ? process.argv[rootFlagIndex + 1] : undefined;
if (rootFlagIndex !== -1 && rootFlagValue === undefined) {
console.error(
'Error: --root requires a directory path argument but none was provided.',
);
process.exit(1);
}
if (rootFlagValue && rootFlagValue.startsWith('--')) {
console.error(
`Error: --root value "${rootFlagValue}" looks like a flag. Provide a valid directory path.`,
);
process.exit(1);
}
const repoRoot = rootFlagValue ?? process.cwd();
const inventory = await collectInventory(repoRoot);
if (inventory.totalFiles === 0) {
console.error('No eval files found under evals/.');
process.exit(1);
}
const registry = buildToolRegistry();
const result = computeCoverage(inventory, registry);
console.log(formatCoverageReport(result));
}
main().catch((error) => {
console.error('Fatal error:', error);
process.exit(1);
});
|