MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / countDependencies

Function countDependencies

cli/src/components/agent-checklist.tsx:19–40  ·  view source on GitHub ↗
(
  agentId: string,
  agentDefinitions: Map<string, { spawnableAgents?: string[] }>,
  localAgentIds: Set<string>,
  visited: Set<string>,
)

Source from the content-addressed store, hash-verified

17
18// Recursively count local dependencies for an agent
19function countDependencies(
20 agentId: string,
21 agentDefinitions: Map<string, { spawnableAgents?: string[] }>,
22 localAgentIds: Set<string>,
23 visited: Set<string>,
24): number {
25 if (visited.has(agentId)) return 0
26 visited.add(agentId)
27
28 const definition = agentDefinitions.get(agentId)
29 const spawnableAgents = definition?.spawnableAgents ?? []
30
31 let count = 0
32 for (const spawnableId of spawnableAgents) {
33 const simpleId = getSimpleAgentId(spawnableId)
34 if (localAgentIds.has(simpleId) && !visited.has(simpleId)) {
35 count += 1 + countDependencies(simpleId, agentDefinitions, localAgentIds, visited)
36 }
37 }
38
39 return count
40}
41
42// Build dependency tree for an agent
43interface DepTreeNode {

Callers 1

AgentChecklistFunction · 0.85

Calls 2

getSimpleAgentIdFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected