MCPcopy Create free account
hub / github.com/JordanCoin/codemap / computeDeps

Method computeDeps

watch/daemon.go:175–208  ·  view source on GitHub ↗

computeDeps builds the file-to-file dependency graph

()

Source from the content-addressed store, hash-verified

173
174// computeDeps builds the file-to-file dependency graph
175func (d *Daemon) computeDeps() {
176 start := time.Now()
177
178 // Build file graph (internal file-to-file dependencies)
179 fg, err := scanner.BuildFileGraph(d.root)
180 if err != nil {
181 if d.verbose {
182 fmt.Printf("[watch] File graph unavailable: %v\n", err)
183 }
184 return
185 }
186
187 d.graph.mu.Lock()
188 defer d.graph.mu.Unlock()
189
190 // Convert FileGraph to DepContext map
191 d.graph.DepCtx = make(map[string]*DepContext)
192 d.graph.FileGraph = fg
193
194 for path := range d.graph.Files {
195 ctx := &DepContext{
196 Imports: fg.Imports[path],
197 Importers: fg.Importers[path],
198 }
199 d.graph.DepCtx[path] = ctx
200 }
201
202 d.graph.HasDeps = true
203
204 hubCount := len(fg.HubFiles())
205 if d.verbose {
206 fmt.Printf("[watch] File graph: %d files, %d hubs in %v\n", len(d.graph.Files), hubCount, time.Since(start))
207 }
208}
209
210// addWatchDirs recursively adds directories to the watcher
211func (d *Daemon) addWatchDirs() error {

Callers 1

StartMethod · 0.95

Calls 2

BuildFileGraphFunction · 0.92
HubFilesMethod · 0.80

Tested by

no test coverage detected