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

Function resolveWatchPaths

src/utils/hooks/fileChangedWatcher.ts:48–65  ·  view source on GitHub ↗
(
  config?: ReturnType<typeof getHooksConfigFromSnapshot>,
)

Source from the content-addressed store, hash-verified

46}
47
48function resolveWatchPaths(
49 config?: ReturnType<typeof getHooksConfigFromSnapshot>,
50): string[] {
51 const matchers = (config ?? getHooksConfigFromSnapshot())?.FileChanged ?? []
52
53 // Matcher field: filenames to watch in cwd, pipe-separated (e.g. ".envrc|.env")
54 const staticPaths: string[] = []
55 for (const m of matchers) {
56 if (!m.matcher) continue
57 for (const name of m.matcher.split('|').map(s => s.trim())) {
58 if (!name) continue
59 staticPaths.push(isAbsolute(name) ? name : join(currentCwd, name))
60 }
61 }
62
63 // Combine static matcher paths with dynamic paths from hook output
64 return [...new Set([...staticPaths, ...dynamicWatchPaths])]
65}
66
67function startWatching(paths: string[]): void {
68 logForDebugging(`FileChanged: watching ${paths.length} paths`)

Callers 2

restartWatchingFunction · 0.85

Calls 2

pushMethod · 0.45

Tested by

no test coverage detected