MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / generateEvalTask

Function generateEvalTask

evals/buffbench/eval-task-generator.ts:96–163  ·  view source on GitHub ↗
({
  client,
  input,
  agentDefinitions,
}: {
  client: CodebuffClient
  input: {
    commitSha: string
    parentSha: string
    diff: string
    editedFilePaths: string[]
    commitMessage?: string
    repoPath: string
  }
  agentDefinitions?: any[]
})

Source from the content-addressed store, hash-verified

94}
95
96export async function generateEvalTask({
97 client,
98 input,
99 agentDefinitions,
100}: {
101 client: CodebuffClient
102 input: {
103 commitSha: string
104 parentSha: string
105 diff: string
106 editedFilePaths: string[]
107 commitMessage?: string
108 repoPath: string
109 }
110 agentDefinitions?: any[]
111}): Promise<{
112 id: string
113 reasoning: string
114 spec: string
115 prompt: string
116 supplementalFiles: string[]
117}> {
118 const { diff, editedFilePaths, commitMessage, repoPath } = input
119
120 const allAgentDefinitions = [
121 evalTaskGeneratorAgentDef,
122 fileExplorerDef,
123 findAllReferencerDef,
124 ...(agentDefinitions || []),
125 ]
126
127 const generatorResult = await client.run({
128 agent: 'eval-task-generator',
129 prompt:
130 'Generate a task specification and user prompt based on the git diff and codebase exploration',
131 params: {
132 diff,
133 editedFilePaths,
134 commitMessage,
135 },
136 cwd: repoPath,
137 agentDefinitions: allAgentDefinitions,
138 handleEvent: (event) => {
139 if (event.type === 'subagent_start') {
140 console.log(`[Agent] Starting: ${event.displayName}`)
141 } else if (event.type === 'tool_call') {
142 console.log(`[Tool] ${event.toolName}`)
143 } else if (event.type === 'text') {
144 console.log(`[Text] ${event.text}...`)
145 }
146 },
147 })
148
149 if (
150 generatorResult.output.type !== 'structuredOutput' ||
151 !generatorResult.output.value
152 ) {
153 throw new Error('Failed to generate structured task output')

Callers 1

processCommitFunction · 0.90

Calls 1

runMethod · 0.45

Tested by

no test coverage detected