MCPcopy Create free account
hub / github.com/anomalyco/opencode-bench / main

Function main

scripts/build-workflow-matrix.ts:88–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88async function main(): Promise<void> {
89 // Read inputs from stdin
90 const stdinText = await Bun.stdin.text();
91 const inputs: WorkflowInputs = JSON.parse(stdinText);
92
93 // Load all evals from dataset
94 const dataset = loadDataset();
95
96 // Build input ID to agent:model mapping dynamically
97 const inputMapping = buildInputMapping();
98
99 // Collect selected agent:model combinations
100 const selectedCombinations: Array<{ agent: string; model: string }> = [];
101
102 for (const [key, value] of Object.entries(inputs)) {
103 // Check if input is true (handle both string "true" and boolean true)
104 if (value !== "true" && value !== true) {
105 continue;
106 }
107
108 // Look up agent:model combination from mapping
109 const combination = inputMapping.get(key);
110 if (combination) {
111 selectedCombinations.push(combination);
112 }
113 }
114
115 if (selectedCombinations.length === 0) {
116 process.stderr.write("Error: At least one model must be selected\n");
117 process.exit(1);
118 }
119
120 // Build matrix: cross product of selected combinations × all evals
121 const include: MatrixEntry[] = dataset.flatMap((entry) =>
122 selectedCombinations.map((combo) => ({
123 agent: combo.agent,
124 model: combo.model,
125 eval: entry.repo,
126 })),
127 );
128
129 const matrix = { include };
130 process.stdout.write(JSON.stringify(matrix));
131 process.exit(0);
132}
133
134await main();

Callers 1

Calls 2

loadDatasetFunction · 0.85
buildInputMappingFunction · 0.85

Tested by

no test coverage detected