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

Method formatFilesByPackage

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

9019 * Format files grouped by the package that owns them
9020 */
9021 private formatFilesByPackage(
9022 projectRoot: string,
9023 files: { path: string; language: string; nodeCount: number }[],
9024 includeMetadata: boolean
9025 ): string {
9026 const groups = groupFilesByPackage(projectRoot, files);
9027 const lines: string[] = [`**${packageListingTitle(groups)}**`, ''];
9028
9029 for (const group of groups) {
9030 lines.push(`**${packageGroupTitle(group)}**`);
9031 for (const file of group.files) {
9032 if (includeMetadata) {
9033 lines.push(`- ${file.path} (${file.language}, ${file.nodeCount} symbols)`);
9034 } else {
9035 lines.push(`- ${file.path}`);
9036 }
9037 }
9038 lines.push('');
9039 }
9040
9041 return lines.join('\n');
9042 }
9043
9044 /**
9045 * 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