(projectRoot: string)
| 1066 | * Get all files in the .codegraph directory |
| 1067 | */ |
| 1068 | export function listDirectoryContents(projectRoot: string): string[] { |
| 1069 | const codegraphDir = getCodeGraphDir(projectRoot); |
| 1070 | |
| 1071 | if (!fs.existsSync(codegraphDir)) { |
| 1072 | return []; |
| 1073 | } |
| 1074 | |
| 1075 | const files: string[] = []; |
| 1076 | |
| 1077 | function walkDir(dir: string, prefix: string = ''): void { |
| 1078 | const entries = fs.readdirSync(dir, { withFileTypes: true }); |
| 1079 | |
| 1080 | for (const entry of entries) { |
| 1081 | const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name; |
| 1082 | |
| 1083 | // Skip symlinks to prevent following links outside .codegraph |
| 1084 | if (entry.isSymbolicLink()) { |
| 1085 | continue; |
| 1086 | } |
| 1087 | |
| 1088 | if (entry.isDirectory()) { |
| 1089 | walkDir(path.join(dir, entry.name), relativePath); |
| 1090 | } else { |
| 1091 | files.push(relativePath); |
| 1092 | } |
| 1093 | } |
| 1094 | } |
| 1095 | |
| 1096 | walkDir(codegraphDir); |
| 1097 | return files; |
| 1098 | } |
| 1099 | |
| 1100 | /** |
| 1101 | * Get the total size of the .codegraph directory in bytes |
nothing calls this directly
no test coverage detected