MCPcopy Index your code
hub / github.com/anomalyco/opencode / rootFor

Function rootFor

packages/app/src/context/layout.tsx:465–485  ·  view source on GitHub ↗
(directory: string)

Source from the content-addressed store, hash-verified

463 })
464
465 const rootFor = (directory: string) => {
466 const map = roots()
467 if (map.size === 0) return directory
468
469 const visited = new Set<string>()
470 const chain = [directory]
471
472 while (chain.length) {
473 const current = chain[chain.length - 1]
474 if (!current) return directory
475
476 const next = map.get(current)
477 if (!next) return current
478
479 if (visited.has(next)) return directory
480 visited.add(next)
481 chain.push(next)
482 }
483
484 return directory
485 }
486
487 createEffect(() => {
488 const projects = server.projects.list()

Callers 2

layout.tsxFile · 0.85
openFunction · 0.85

Calls 4

rootsFunction · 0.85
pushMethod · 0.80
getMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected