MCPcopy
hub / github.com/codeaashu/claude-code / maybeDumpAutoMode

Function maybeDumpAutoMode

src/utils/permissions/yoloClassifier.ts:153–180  ·  view source on GitHub ↗

* Dump the auto mode classifier request and response bodies to the per-user * claude temp directory when CLAUDE_CODE_DUMP_AUTO_MODE is set. Files are * named by unix timestamp: {timestamp}[.{suffix}].req.json and .res.json

(
  request: unknown,
  response: unknown,
  timestamp: number,
  suffix?: string,
)

Source from the content-addressed store, hash-verified

151 * named by unix timestamp: {timestamp}[.{suffix}].req.json and .res.json
152 */
153async function maybeDumpAutoMode(
154 request: unknown,
155 response: unknown,
156 timestamp: number,
157 suffix?: string,
158): Promise<void> {
159 if (process.env.USER_TYPE !== 'ant') return
160 if (!isEnvTruthy(process.env.CLAUDE_CODE_DUMP_AUTO_MODE)) return
161 const base = suffix ? `${timestamp}.${suffix}` : `${timestamp}`
162 try {
163 await mkdir(getAutoModeDumpDir(), { recursive: true })
164 await writeFile(
165 join(getAutoModeDumpDir(), `${base}.req.json`),
166 jsonStringify(request, null, 2),
167 'utf-8',
168 )
169 await writeFile(
170 join(getAutoModeDumpDir(), `${base}.res.json`),
171 jsonStringify(response, null, 2),
172 'utf-8',
173 )
174 logForDebugging(
175 `Dumped auto mode req/res to ${getAutoModeDumpDir()}/${base}.{req,res}.json`,
176 )
177 } catch {
178 // Ignore errors
179 }
180}
181
182/**
183 * Session-scoped dump file for auto mode classifier error prompts. Written on API

Callers 2

classifyYoloActionXmlFunction · 0.85
classifyYoloActionFunction · 0.85

Calls 5

isEnvTruthyFunction · 0.85
mkdirFunction · 0.85
getAutoModeDumpDirFunction · 0.85
jsonStringifyFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected