MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / formatPathTree

Function formatPathTree

src/utils/renderers/path-tree.ts:149–170  ·  view source on GitHub ↗
(
  entries: readonly PathTreeEntry[],
  options: PathTreeFormatOptions = {},
)

Source from the content-addressed store, hash-verified

147}
148
149export function formatPathTree(
150 entries: readonly PathTreeEntry[],
151 options: PathTreeFormatOptions = {},
152): string[] {
153 const formatPath = options.formatPath ?? ((path: string): string => path);
154 const root = createNode('', '');
155 const parsedPaths = entries
156 .map(parseRawPath)
157 .filter((entry): entry is ParsedPath => entry !== null)
158 .sort((left, right) => left.sortablePath.localeCompare(right.sortablePath));
159
160 for (const parsedPath of parsedPaths) {
161 addPath(root, parsedPath);
162 }
163
164 const nodes = topLevelNodes(root).sort((left, right) =>
165 left.rawPath.localeCompare(right.rawPath),
166 );
167 return nodes.flatMap((child, index) =>
168 renderNode(child, '', index === nodes.length - 1, undefined, formatPath),
169 );
170}

Callers 2

formatDetailTreeLinesFunction · 0.90
path-tree.test.tsFile · 0.90

Calls 4

addPathFunction · 0.85
topLevelNodesFunction · 0.85
renderNodeFunction · 0.85
createNodeFunction · 0.70

Tested by

no test coverage detected