MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / segmentsOf

Function segmentsOf

scripts/agent-eval/compare-arms.mjs:27–36  ·  view source on GitHub ↗

Segment files of one run, in turn order: run-X.jsonl, run-X.t2.jsonl, …

(dir, stem)

Source from the content-addressed store, hash-verified

25
26/** Segment files of one run, in turn order: run-X.jsonl, run-X.t2.jsonl, … */
27function segmentsOf(dir, stem) {
28 const first = join(dir, `${stem}.jsonl`);
29 if (!existsSync(first)) return null;
30 const rest = readdirSync(dir)
31 .map((f) => [f, new RegExp(`^${stem.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\.t(\\d+)\\.jsonl$`).exec(f)])
32 .filter(([, m]) => m)
33 .sort((a, b) => Number(a[1][1]) - Number(b[1][1]))
34 .map(([f]) => join(dir, f));
35 return [first, ...rest];
36}
37
38/** Every run of one arm, newest-numbering-first-run order. */
39export function discoverRuns(dir, label) {

Callers 1

discoverRunsFunction · 0.85

Calls 4

NumberInterface · 0.85
mapMethod · 0.80
execMethod · 0.65
joinFunction · 0.50

Tested by

no test coverage detected