MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / inspectTreeStructure

Function inspectTreeStructure

src/services/tree-sitter/__tests__/helpers.ts:113–126  ·  view source on GitHub ↗
(content: string, language: string = "typescript")

Source from the content-addressed store, hash-verified

111
112// Helper function to inspect tree structure
113export async function inspectTreeStructure(content: string, language: string = "typescript"): Promise<string> {
114 const { Parser, Language } = await initializeTreeSitter()
115 const parser = new Parser()
116 const wasmPath = path.join(process.cwd(), `dist/tree-sitter-${language}.wasm`)
117 const lang = await Language.load(wasmPath)
118 parser.setLanguage(lang)
119
120 // Parse the content
121 const tree = parser.parse(content)
122
123 // Print the tree structure
124 debugLog(`TREE STRUCTURE (${language}):\n${tree?.rootNode.toString()}`)
125 return tree?.rootNode.toString() || ""
126}

Calls 6

initializeTreeSitterFunction · 0.85
loadMethod · 0.80
parseMethod · 0.80
debugLogFunction · 0.70
toStringMethod · 0.65
cwdMethod · 0.45

Tested by

no test coverage detected