forked from posecode-dev/posecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.ts
More file actions
28 lines (25 loc) · 999 Bytes
/
Copy pathgenerator.ts
File metadata and controls
28 lines (25 loc) · 999 Bytes
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
/**
* Movement sources for the harness.
*
* The fixture generator reads the canonical `spec/examples`: the regression
* baseline. LLM generators implement the same interface so "ask model X for a
* deadlift, score what it wrote" plugs straight into `runEval` (they need API
* keys, so they live with the caller, not here).
*/
import { readdirSync, readFileSync } from "node:fs";
import { basename, join } from "node:path";
import type { MovementSource } from "./report.js";
export interface MovementGenerator {
/** Produce `.posecode` source for the named movements. */
generate(movements: readonly string[]): Promise<MovementSource[]>;
}
/** Load every `.posecode` fixture in a directory (movement id = file stem). */
export function loadFixtures(dir: string): MovementSource[] {
return readdirSync(dir)
.filter((f) => f.endsWith(".posecode"))
.sort()
.map((f) => ({
movement: basename(f, ".posecode"),
source: readFileSync(join(dir, f), "utf8"),
}));
}