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

Function sortNodes

sdk/src/run-state.ts:820–835  ·  view source on GitHub ↗
(nodes: FileTreeNode[])

Source from the content-addressed store, hash-verified

818
819 // Sort function for nodes
820 function sortNodes(nodes: FileTreeNode[]): void {
821 nodes.sort((a, b) => {
822 // Directories first, then files
823 if (a.type !== b.type) {
824 return a.type === 'directory' ? -1 : 1
825 }
826 return a.name.localeCompare(b.name)
827 })
828
829 // Recursively sort children
830 for (const node of nodes) {
831 if (node.children) {
832 sortNodes(node.children)
833 }
834 }
835 }
836
837 sortNodes(rootNodes)
838 return rootNodes

Callers 1

buildFileTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected