MCPcopy Create free account
hub / github.com/agent-tower/core / addWatcher

Function addWatcher

packages/server/scripts/dev.mjs:90–108  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

88 }, 150);
89}
90
91function addWatcher(dir) {
92 const watcher = watch(dir, (eventType, filename) => {
93 const changedPath = filename ? path.join(dir, filename.toString()) : dir;
94
95 if (eventType === 'rename') {
96 scheduleRescan();
97 }
98
99 scheduleRestart(changedPath);
100 });
101
102 watcher.on('error', (error) => {
103 log(`watch error in ${path.relative(packageRoot, dir) || '.'}: ${error.message}`);
104 scheduleRescan();
105 scheduleRestart(dir);
106 });
107
108 watchedDirs.set(dir, watcher);
109}
110
111function syncWatchers() {

Callers 1

syncWatchersFunction · 0.85

Calls 6

scheduleRescanFunction · 0.85
scheduleRestartFunction · 0.85
setMethod · 0.80
logFunction · 0.70
joinMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected