Skip to content

Commit e782b36

Browse files
committed
chore: format and lint branch changes
1 parent c99697e commit e782b36

33 files changed

+299
-172
lines changed

.agents/LESSONS.md

Lines changed: 125 additions & 44 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ Before you begin, you'll need to install a few tools:
5151
5. **Start development services**:
5252

5353
**Option A: All-in-one (recommended)**
54+
5455
```bash
5556
bun run dev
5657
# Starts the web server, builds the SDK, and launches the CLI automatically
5758
```
5859

5960
**Option B: Separate terminals (for more control)**
61+
6062
```bash
6163
# Terminal 1 - Web server (start first)
6264
bun run start-web
@@ -201,7 +203,7 @@ cd cli
201203
bun run test:tmux-poc
202204
```
203205

204-
See [cli/src/__tests__/README.md](cli/src/__tests__/README.md) for comprehensive interactive testing documentation.
206+
See [cli/src/**tests**/README.md](cli/src/__tests__/README.md) for comprehensive interactive testing documentation.
205207

206208
### Commit Messages
207209

common/src/mcp/client.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ export async function callMCPTool(
154154
mediaType: c.resource.mimeType ?? 'text/plain',
155155
} satisfies ToolResultOutput
156156
}
157-
const fallbackValue = 'uri' in c && typeof (c as { uri: unknown }).uri === 'string'
158-
? (c as { uri: string }).uri
159-
: JSON.stringify(c)
157+
const fallbackValue =
158+
'uri' in c && typeof (c as { uri: unknown }).uri === 'string'
159+
? (c as { uri: string }).uri
160+
: JSON.stringify(c)
160161
return {
161162
type: 'json',
162163
value: fallbackValue,

evals/buffbench/eval-codebuff.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
}
1010
],
1111
"initCommand": "bun install && git checkout -- bun.lock",
12-
"finalCheckCommands": [
13-
"bun run typecheck",
14-
"bun run test"
15-
],
12+
"finalCheckCommands": ["bun run typecheck", "bun run test"],
1613
"env": {
1714
"ANTHROPIC_API_KEY": "test-key",
1815
"ANTHROPIC_API_KEY2": "test-key-2",
@@ -3193,4 +3190,4 @@
31933190
]
31943191
}
31953192
]
3196-
}
3193+
}

evals/buffbench/gen-evals.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { execSync } from 'child_process'
2-
import { createTwoFilesPatch } from 'diff'
32
import fs from 'fs'
43
import path from 'path'
5-
import { mapLimit } from 'async'
64

75
import { API_KEY_ENV_VAR } from '@codebuff/common/old-constants'
8-
96
import { CodebuffClient, getUserCredentials } from '@codebuff/sdk'
7+
import { mapLimit } from 'async'
8+
import { createTwoFilesPatch } from 'diff'
9+
10+
import { generateEvalTask } from './eval-task-generator'
1011
import { extractRepoNameFromUrl } from './setup-test-repo'
1112
import { withTestRepoAndParent } from '../subagents/test-repo-utils'
12-
import { generateEvalTask } from './eval-task-generator'
1313

1414
import type { EvalDataV2, EvalCommitV2, FileDiff } from './types'
1515

@@ -207,24 +207,20 @@ export async function generateEvalFileV2({
207207
)
208208
}
209209

210-
const batchResults = await mapLimit(
211-
commitShas,
212-
BATCH_SIZE,
213-
async (commitSha: string) => {
214-
const result = await processCommit(commitSha)
215-
if (result) {
216-
evalCommits.push(result)
217-
218-
const partialEvalData: EvalDataV2 = {
219-
repoUrl,
220-
generationDate: new Date().toISOString(),
221-
evalCommits: [...evalCommits],
222-
}
223-
savePartialResults(partialOutputPath, partialEvalData)
210+
await mapLimit(commitShas, BATCH_SIZE, async (commitSha: string) => {
211+
const result = await processCommit(commitSha)
212+
if (result) {
213+
evalCommits.push(result)
214+
215+
const partialEvalData: EvalDataV2 = {
216+
repoUrl,
217+
generationDate: new Date().toISOString(),
218+
evalCommits: [...evalCommits],
224219
}
225-
return result
226-
},
227-
)
220+
savePartialResults(partialOutputPath, partialEvalData)
221+
}
222+
return result
223+
})
228224

229225
const evalData: EvalDataV2 = {
230226
repoUrl,

evals/buffbench/pick-commits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import fs from 'fs'
55
import path from 'path'
66

77
import { disableLiveUserInputCheck } from '@codebuff/agent-runtime/live-user-inputs'
8-
import { promptAiSdkStructured } from '@codebuff/sdk/impl/llm'
98
import { models } from '@codebuff/common/old-constants'
109
import { userMessage } from '@codebuff/common/util/messages'
10+
import { promptAiSdkStructured } from '@codebuff/sdk'
1111
import { mapLimit } from 'async'
1212
import { z } from 'zod/v4'
1313

evals/buffbench/run-buffbench.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1+
import { execSync } from 'child_process'
12
import fs from 'fs'
2-
import path from 'path'
33
import os from 'os'
4-
import { execSync } from 'child_process'
4+
import path from 'path'
55

66
import { API_KEY_ENV_VAR } from '@codebuff/common/old-constants'
7+
import {
8+
CodebuffClient,
9+
getUserCredentials,
10+
loadLocalAgents,
11+
} from '@codebuff/sdk'
712
import pLimit from 'p-limit'
813

914
import { runAgentOnCommit, type ExternalAgentType } from './agent-runner'
1015
import { formatTaskResults } from './format-output'
1116
import { judgeCommitResult } from './judge'
12-
import { analyzeAgentTraces, type AgentTraceData } from './trace-analyzer'
1317
import { extractAgentLessons, saveAgentLessons } from './lessons-extractor'
14-
import { CodebuffClient, getUserCredentials, loadLocalAgents } from '@codebuff/sdk'
18+
import { analyzeAgentTraces, type AgentTraceData } from './trace-analyzer'
1519
import { logger } from '../logger'
16-
import type { AgentEvalResults, EvalDataV2, EvalCommitV2 } from './types'
1720
import { analyzeAllTasks } from './meta-analyzer'
1821

22+
import type { AgentEvalResults, EvalDataV2, EvalCommitV2 } from './types'
23+
1924
function parseAgentId(agent: string): {
2025
agentId: string
2126
externalAgentType?: ExternalAgentType
@@ -340,12 +345,12 @@ export async function runBuffBench(options: {
340345
(f) => f.data.binInstalls ?? [],
341346
)
342347
const uniqueBinInstalls = allBinInstalls.filter(
343-
(bin, index, self) =>
344-
index === self.findIndex((b) => b.name === bin.name),
348+
(bin, index, self) => index === self.findIndex((b) => b.name === bin.name),
345349
)
346350

347351
// Install binaries once at the beginning
348-
const { tempDir: binsTempDir, env: binsEnv } = installBinaries(uniqueBinInstalls)
352+
const { tempDir: binsTempDir, env: binsEnv } =
353+
installBinaries(uniqueBinInstalls)
349354

350355
let commitsToRun: CommitWithSource[]
351356
if (taskIds && taskIds.length > 0) {
@@ -362,7 +367,9 @@ export async function runBuffBench(options: {
362367
}
363368

364369
if (notFoundIds.length > 0) {
365-
const availableIds = allCommitsWithSource.map((c) => c.commit.id).join(', ')
370+
const availableIds = allCommitsWithSource
371+
.map((c) => c.commit.id)
372+
.join(', ')
366373
throw new Error(
367374
`Task ID(s) not found: ${notFoundIds.join(', ')}. Available task IDs: ${availableIds}`,
368375
)
@@ -473,7 +480,7 @@ export async function runBuffBench(options: {
473480
}
474481
}
475482

476-
for (const [_agentId, agentData] of Object.entries(results)) {
483+
for (const agentData of Object.values(results)) {
477484
// Filter out runs from commits where ANY agent had an error
478485
const validRuns = agentData.runs.filter(
479486
(r) => !commitShasWithErrors.has(r.commitSha),

evals/scaffolding.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import path from 'path'
55
import { runAgentStep } from '@codebuff/agent-runtime/run-agent-step'
66
import { assembleLocalAgentTemplates } from '@codebuff/agent-runtime/templates/agent-registry'
77
import { getFileTokenScores } from '@codebuff/code-map/parse'
8-
import { clientToolCallSchema } from '@codebuff/common/tools/list'
98
import { API_KEY_ENV_VAR, TEST_USER_ID } from '@codebuff/common/old-constants'
9+
import { clientToolCallSchema } from '@codebuff/common/tools/list'
1010
import { generateCompactId } from '@codebuff/common/util/string'
1111
import { getSystemInfo } from '@codebuff/common/util/system-info'
1212
import { ToolHelpers } from '@codebuff/sdk'
@@ -297,14 +297,12 @@ export async function runToolCalls(toolCalls: ClientToolCall[]) {
297297
export async function loopMainPrompt({
298298
sessionState,
299299
prompt,
300-
projectPath,
301300
maxIterations,
302301
stopCondition,
303302
agentType,
304303
}: {
305304
sessionState: SessionState
306305
prompt: string
307-
projectPath: string
308306
maxIterations: number
309307
stopCondition?: (sessionState: AgentState) => boolean
310308
agentType: AgentTemplateType

evals/subagents/eval-planner.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import * as fs from 'fs'
22
import * as path from 'path'
3-
import { createTwoFilesPatch } from 'diff'
43

4+
import { API_KEY_ENV_VAR } from '@codebuff/common/old-constants'
55
import {
6-
AgentDefinition,
76
CodebuffClient,
87
getUserCredentials,
98
loadLocalAgents,
109
} from '@codebuff/sdk'
11-
import { API_KEY_ENV_VAR } from '@codebuff/common/old-constants'
10+
import { createTwoFilesPatch } from 'diff'
11+
1212
import { withTestRepo } from './test-repo-utils'
1313

14+
import type { AgentDefinition } from '@codebuff/sdk'
15+
1416
export const evalPlannerAgent = async (params: {
1517
client: CodebuffClient
1618
agentId: string

evals/test-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const SWE_BENCH_PYTHON_PATH = path.join(
2424
// Mock required environment variables for tests
2525
export function setupTestEnvironmentVariables() {
2626
// Set up mock environment variables needed for tests
27-
// Add other required environment variables as needed
27+
// Add other required environment variables as needed
2828
}
2929

3030
// Patch the run_docker.py script to add git config command

0 commit comments

Comments
 (0)