Skip to content

Commit 3942952

Browse files
committed
Get dev authToken if CODEBUFF_API_KEY not provided
1 parent 38abc6d commit 3942952

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

evals/git-evals/runners/codebuff.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import { loadLocalAgents } from '@codebuff/npm-app/agents/load-agents'
55
import type { Runner } from './runner'
66
import type { RunState } from '../../../sdk/src/index'
77
import type { AgentStep } from '../../scaffolding'
8+
import { API_KEY_ENV_VAR } from '@codebuff/common/constants'
9+
import { getUserCredentials } from '@codebuff/npm-app/credentials'
10+
11+
const getLocalAuthToken = () => {
12+
return getUserCredentials()?.authToken
13+
}
814

915
export class CodebuffRunner implements Runner {
1016
private client: CodebuffClient | null
@@ -29,8 +35,11 @@ export class CodebuffRunner implements Runner {
2935
toolResults = []
3036
}
3137

38+
const apiKey = process.env[API_KEY_ENV_VAR] || getLocalAuthToken()
39+
3240
if (!this.client) {
3341
this.client = new CodebuffClient({
42+
apiKey,
3443
cwd: this.runState.sessionState.fileContext.cwd,
3544
onError: (error) => {
3645
throw new Error(error.message)

0 commit comments

Comments
 (0)