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

Function handleFileEvent

src/utils/hooks/fileChangedWatcher.ts:80–106  ·  view source on GitHub ↗
(
  path: string,
  event: 'change' | 'add' | 'unlink',
)

Source from the content-addressed store, hash-verified

78}
79
80function handleFileEvent(
81 path: string,
82 event: 'change' | 'add' | 'unlink',
83): void {
84 logForDebugging(`FileChanged: ${event} ${path}`)
85 void executeFileChangedHooks(path, event)
86 .then(({ results, watchPaths, systemMessages }) => {
87 if (watchPaths.length > 0) {
88 updateWatchPaths(watchPaths)
89 }
90 for (const msg of systemMessages) {
91 notifyCallback?.(msg, false)
92 }
93 for (const r of results) {
94 if (!r.succeeded && r.output) {
95 notifyCallback?.(r.output, true)
96 }
97 }
98 })
99 .catch(e => {
100 const msg = errorMessage(e)
101 logForDebugging(`FileChanged hook failed: ${msg}`, {
102 level: 'error',
103 })
104 notifyCallback?.(msg, true)
105 })
106}
107
108export function updateWatchPaths(paths: string[]): void {
109 if (!initialized) return

Callers 1

startWatchingFunction · 0.85

Calls 4

logForDebuggingFunction · 0.85
executeFileChangedHooksFunction · 0.85
updateWatchPathsFunction · 0.85
errorMessageFunction · 0.50

Tested by

no test coverage detected