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

Function writeTrace

agents/e2e/base-deep.e2e.test.ts:132–164  ·  view source on GitHub ↗
(params: {
    testName: string
    events: PrintModeEvent[]
    runOutput: unknown
    cwd: string
    notes?: Record<string, unknown>
  })

Source from the content-addressed store, hash-verified

130 }
131
132 const writeTrace = async (params: {
133 testName: string
134 events: PrintModeEvent[]
135 runOutput: unknown
136 cwd: string
137 notes?: Record<string, unknown>
138 }) => {
139 await fs.promises.mkdir(traceDir, { recursive: true })
140 const timestamp = new Date().toISOString().replaceAll(':', '-')
141 const fileName = `${timestamp}-${sanitizeForPath(params.testName)}.json`
142 const tracePath = path.join(traceDir, fileName)
143 const toolCalls = getToolCallNames(params.events)
144 const subagents = getSpawnedAgentTypes(params.events)
145 const payload = {
146 testName: params.testName,
147 cwd: params.cwd,
148 createdAt: new Date().toISOString(),
149 summary: {
150 eventCount: params.events.length,
151 toolCalls,
152 subagents,
153 thinkerErrorCount: countThinkerToolErrors(params.events),
154 },
155 notes: params.notes,
156 runOutput: params.runOutput,
157 events: params.events,
158 }
159 await fs.promises.writeFile(
160 tracePath,
161 JSON.stringify(payload, null, 2),
162 'utf-8',
163 )
164 }
165
166 const createShallowClone = async () => {
167 const cloneDir = await fs.promises.mkdtemp(

Callers 1

Calls 5

sanitizeForPathFunction · 0.85
getToolCallNamesFunction · 0.85
getSpawnedAgentTypesFunction · 0.85
countThinkerToolErrorsFunction · 0.85
writeFileMethod · 0.80

Tested by

no test coverage detected