MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / formatFilesByPackage

Method formatFilesByPackage

src/mcp/tools.ts:8848–8869  ·  view source on GitHub ↗

* Format files grouped by the package that owns them

(
    projectRoot: string,
    files: { path: string; language: string; nodeCount: number }[],
    includeMetadata: boolean
  )

Source from the content-addressed store, hash-verified

8846 * Format files grouped by the package that owns them
8847 */
8848 private formatFilesByPackage(
8849 projectRoot: string,
8850 files: { path: string; language: string; nodeCount: number }[],
8851 includeMetadata: boolean
8852 ): string {
8853 const groups = groupFilesByPackage(projectRoot, files);
8854 const lines: string[] = [`**${packageListingTitle(groups)}**`, ''];
8855
8856 for (const group of groups) {
8857 lines.push(`**${packageGroupTitle(group)}**`);
8858 for (const file of group.files) {
8859 if (includeMetadata) {
8860 lines.push(`- ${file.path} (${file.language}, ${file.nodeCount} symbols)`);
8861 } else {
8862 lines.push(`- ${file.path}`);
8863 }
8864 }
8865 lines.push('');
8866 }
8867
8868 return lines.join('\n');
8869 }
8870
8871 /**
8872 * Format files as a tree structure

Callers 1

handleFilesMethod · 0.95

Calls 5

groupFilesByPackageFunction · 0.90
packageListingTitleFunction · 0.90
packageGroupTitleFunction · 0.90
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected