MCPcopy Create free account
hub / github.com/StepfenShawn/ShitCodify / traverseFiles

Function traverseFiles

src/utils/promptGenerator.ts:107–120  ·  view source on GitHub ↗
(nodes: FileNode[], depth: number = 0)

Source from the content-addressed store, hash-verified

105 let result = '';
106
107 function traverseFiles(nodes: FileNode[], depth: number = 0) {
108 for (const node of nodes) {
109 // 使用空格字符串拼接而不是 repeat 方法
110 let indent = '';
111 for (let i = 0; i < depth * 2; i++) {
112 indent += ' ';
113 }
114 result += `${indent}${node.isDirectory ? '📁' : '📄'} ${node.name}\n`;
115
116 if (node.isDirectory && node.children) {
117 traverseFiles(node.children, depth + 1);
118 }
119 }
120 }
121
122 traverseFiles(files);
123 return result;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected