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

Function main

scripts/sync-workflow-inputs.ts:34–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32}
33
34async function main(): Promise<void> {
35 const workflowPath = ".github/workflows/compare-models.yml";
36
37 // Load the workflow file
38 const workflowContent = readFileSync(workflowPath, "utf8");
39 const workflow = YAML.parse(workflowContent);
40
41 // Get all available agent:model combinations
42 const agents = Agent.list();
43 const combinations: Array<{ agent: string; model: string }> = [];
44
45 for (const agent of agents) {
46 for (const model of agent.models) {
47 combinations.push({ agent: agent.name, model });
48 }
49 }
50
51 if (combinations.length === 0) {
52 console.error("No agent:model combinations found");
53 process.exit(1);
54 }
55
56 // Build new inputs
57 const inputs: WorkflowInputs = {};
58
59 for (const { agent, model } of combinations) {
60 const inputId = toInputId(agent, model);
61 inputs[inputId] = {
62 description: toDescription(agent, model),
63 type: "boolean",
64 default: false,
65 };
66 }
67
68 // Update the workflow
69 workflow.on.workflow_dispatch.inputs = inputs;
70
71 // Convert back to YAML with proper formatting
72 const yamlOutput = YAML.stringify(workflow, {
73 indent: 2,
74 lineWidth: 0,
75 });
76
77 // Write back to file
78 writeFileSync(workflowPath, yamlOutput, "utf8");
79
80 console.log(
81 `✓ Updated ${workflowPath} with ${combinations.length} agent:model combinations:`,
82 );
83 for (const { agent, model } of combinations) {
84 console.log(` - ${agent}:${model} (ID: ${toInputId(agent, model)})`);
85 }
86
87 console.log(
88 "\n✓ The build-workflow-matrix.ts script will automatically recognize these combinations.",
89 );
90 console.log(
91 " No manual updates needed - everything is dynamically generated!",

Callers 1

Calls 2

toInputIdFunction · 0.85
toDescriptionFunction · 0.85

Tested by

no test coverage detected