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

Method formatFilesByPackage

src/mcp/tools.ts:8995–9016  ·  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

8993 * Format files grouped by the package that owns them
8994 */
8995 private formatFilesByPackage(
8996 projectRoot: string,
8997 files: { path: string; language: string; nodeCount: number }[],
8998 includeMetadata: boolean
8999 ): string {
9000 const groups = groupFilesByPackage(projectRoot, files);
9001 const lines: string[] = [`**${packageListingTitle(groups)}**`, ''];
9002
9003 for (const group of groups) {
9004 lines.push(`**${packageGroupTitle(group)}**`);
9005 for (const file of group.files) {
9006 if (includeMetadata) {
9007 lines.push(`- ${file.path} (${file.language}, ${file.nodeCount} symbols)`);
9008 } else {
9009 lines.push(`- ${file.path}`);
9010 }
9011 }
9012 lines.push('');
9013 }
9014
9015 return lines.join('\n');
9016 }
9017
9018 /**
9019 * 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