MCPcopy Index your code
hub / github.com/codeaashu/claude-code / handleChange

Function handleChange

src/utils/settings/changeDetector.ts:268–302  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

266}
267
268function handleChange(path: string): void {
269 const source = getSourceForPath(path)
270 if (!source) return
271
272 // If a deletion was pending for this path (delete-and-recreate pattern),
273 // cancel the deletion — we'll process this as a change instead.
274 const pendingTimer = pendingDeletions.get(path)
275 if (pendingTimer) {
276 clearTimeout(pendingTimer)
277 pendingDeletions.delete(path)
278 logForDebugging(
279 `Cancelled pending deletion of ${path} — file was recreated`,
280 )
281 }
282
283 // Check if this was an internal write
284 if (consumeInternalWrite(path, INTERNAL_WRITE_WINDOW_MS)) {
285 return
286 }
287
288 logForDebugging(`Detected change to ${path}`)
289
290 // Fire ConfigChange hook first — if blocked (exit code 2 or decision: 'block'),
291 // skip applying the change to the session
292 void executeConfigChangeHooks(
293 settingSourceToConfigChangeSource(source),
294 path,
295 ).then(results => {
296 if (hasBlockingResult(results)) {
297 logForDebugging(`ConfigChange hook blocked change to ${path}`)
298 return
299 }
300 fanOut(source)
301 })
302}
303
304/**
305 * Handle a file being re-added (e.g. after a delete-and-recreate). Cancels any

Callers 1

handleAddFunction · 0.70

Calls 9

getSourceForPathFunction · 0.85
logForDebuggingFunction · 0.85
consumeInternalWriteFunction · 0.85
executeConfigChangeHooksFunction · 0.85
hasBlockingResultFunction · 0.85
fanOutFunction · 0.85
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected